public Relationship SetInProperty(string name, PropertyType type, bool nullable = true) { if (InProperty != null) { throw new InvalidOperationException("There is already an in property defined."); } switch (type) { case PropertyType.Lookup: InEntity.AddLookup(name, OutEntity, nullable); break; case PropertyType.Collection: InEntity.AddCollection(name, OutEntity); break; default: throw new NotSupportedException(); } InProperty = InEntity.Properties[name]; InProperty.Relationship = this; InProperty.Direction = DirectionEnum.In; // StaticData InEntity.DynamicEntityPropertyAdded(InProperty); return(this); }
void IRefactorRelationship.SetInEntity(Entity target, bool allowLosingData) { Parent.EnsureSchemaMigration(); if (target.IsSubsclassOf(InEntity)) { if (!allowLosingData) { throw new ArgumentException(string.Format("Target {0} is a sub type of {1}, you could lose data. If you want to do this anyway, you can set allowLosingData to true.", target.Name, InEntity.Name), "baseType"); } foreach (var item in InEntity.GetSubclasses()) { if (item.IsAbstract || item.IsVirtual) { continue; } if (item.IsSelfOrSubclassOf(target)) { continue; } //delete relations Parent.Templates.RemoveRelationship(template => { template.InEntity = item.Label.Name; template.Relation = Neo4JRelationshipType; template.OutEntity = OutEntity.Label.Name; }).RunBatched(); } } else if (!InEntity.IsSubsclassOf(target)) { throw new ArgumentException(string.Format("Target {0} is not a base or sub type of {1}. Consider using 'Reroute'.", target.Name, InEntity.Name), "baseType"); } if (InProperty != null) { InEntity.Properties.Remove(InProperty.Name); target.Properties.Add(InProperty.Name, InProperty); InProperty.SetParentEntity(target); } if (OutProperty != null) { OutProperty.SetReturnTypeEntity(target); } InInterface = new Interface(target); }
public JsonResult Push([FromBody] InEntity content) { return(ServiceEngine.InvokeMethod(content.ServiceCode, content.CurrentUserId, content.AccessToken, content.CurrentSendParameter)); }