public ValidationContext(IStructuralObject so) { Entity = so as IEntity; if (Entity == null) { ComplexObject = (IComplexObject)so; Entity = ComplexObject.ComplexAspect.ParentEntity; } }
// Note: the Parent and ParentProperty properties are assigned (if assigned) when it is first created within the context of a parentEntity // A complexAspect without these properties will be absorbed by a complexAspect with these properties during any assignment. // Note that this method creates a child and updates its refs to the parent but does // NOT update the parent. This is deliberate because instances of OriginalVersions should not be stored // in the parent objects refs whereas CurrentVersions should. internal static IComplexObject Create(IStructuralObject parent, DataProperty parentProperty) { var co = (IComplexObject)Activator.CreateInstance(parentProperty.ClrType); var aspect = co.ComplexAspect; aspect.ComplexType = parentProperty.ComplexType; aspect.Parent = parent; aspect.ParentProperty = parentProperty; return(co); }
/// <summary> /// Returns either a EntityAspect or ComplexAspect for the associated IStructuralObject. /// </summary> /// <param name="so"></param> /// <returns></returns> public static StructuralAspect GetStructuralAspect(this IStructuralObject so) { var entity = so as IEntity; if (entity != null) { return(entity.EntityAspect); } else { return(((IComplexObject)so).ComplexAspect); } }
private JNode EntityToJNode(IStructuralObject so) { var entity = so as IEntity; JNode jn; if (entity != null) { var entityAspect = entity.EntityAspect; jn = DataToJNode(entityAspect); jn.AddJNode("entityAspect", BuildEntityAspectNode(entityAspect)); } else { var complexAspect = ((IComplexObject)so).ComplexAspect; jn = DataToJNode(complexAspect); } return jn; }
private JNode EntityToJNode(IStructuralObject so) { var entity = so as IEntity; JNode jn; if (entity != null) { var entityAspect = entity.EntityAspect; jn = DataToJNode(entityAspect); jn.AddJNode("entityAspect", BuildEntityAspectNode(entityAspect)); } else { var complexAspect = ((IComplexObject)so).ComplexAspect; jn = DataToJNode(complexAspect); } return(jn); }
public ValidationContext(IStructuralObject so, StructuralProperty property, Object propertyValue) : this(so) { Property = property; PropertyValue = propertyValue; }
public StructuralAspect(IStructuralObject stObj) { _backingStore = (stObj is IHasBackingStore) ? null : new Dictionary <String, Object>(); }