U4-4368 - Cannot insert the value NULL into column 'name' when creating new relation type from API

Created by Simon Dingley 10 Mar 2014, 09:09:39 Updated by Shannon Deminick 17 Mar 2014, 02:19:40

The RelationType constructor only accepts the RelationType alias and not the name. We should probably add another overload that accepts alias and name and update the existing constructor to use the alias also as the name.

Comments

Sebastiaan Janssen 10 Mar 2014, 09:33:07

Version please? And a little example of what you're trying to do would be very helpful.


Simon Dingley 10 Mar 2014, 09:37:09

Sorry early Monday morning :(

Umbraco 7.0.4, the following code will result i the exception being thrown:

var rs = ApplicationContext.Current.Services.RelationService; var rt = new RelationType(new Guid(Constants.ObjectTypes.Document), new Guid(Constants.ObjectTypes.Document), "repeatedEventOccurence"); rs.Save(rt);

However this will work fine:

var rs = ApplicationContext.Current.Services.RelationService; var rt = new RelationType(new Guid(Constants.ObjectTypes.Document), new Guid(Constants.ObjectTypes.Document), "repeatedEventOccurence"); rt.Name = "repeatedEventOccurence"; rs.Save(rt);


Sebastiaan Janssen 16 Mar 2014, 09:32:29

Thanks Simon, also affect v6, should be an easy fix!


Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 6.2.0, 7.0.4

Due in version: 7.1.0, 6.2.0

Sprint:

Story Points:

Cycle: