Beispiel #1
0
 /// <summary>
 /// Create a new Entity. Used to create InMemory Entities that are not persisted to the EAV SqlStore.
 /// </summary>
 public Entity(int entityId, string contentTypeName, IDictionary<string, object> values, string titleAttribute, DateTime? modified = null)
 {
     EntityId = entityId;
     Type = new ContentType(contentTypeName);
     Attributes = AttributeHelperTools.GetTypedDictionaryForSingleLanguage(values, titleAttribute);
     try
     {
         Title = Attributes[titleAttribute];
     }
     catch (KeyNotFoundException)
     {
         throw new KeyNotFoundException(string.Format("The Title Attribute with Name \"{0}\" doesn't exist in the Entity-Attributes.", titleAttribute));
     }
     AssignmentObjectTypeId = Constants.DefaultAssignmentObjectTypeId;
     IsPublished = true;
     if (modified.HasValue)
         Modified = modified.Value;
     Relationships = new RelationshipManager(this, new EntityRelationshipItem[0]);
 }
Beispiel #2
0
 public void ContentType_GeneralTest()
 {
     var x = new ContentType("SomeName");
     Assert.AreEqual("SomeName", x.Name);
     Assert.AreEqual(null, x.Scope); // not set, should be blank
 }