public void AddJoin(ObjectSubQueryJoin joinSpecification, string childAlias, string parentAlias) { EnsureSubQuery(childAlias, joinSpecification.ChildType); EnsureSubQuery(parentAlias, joinSpecification.ParentType); string manyToOneForeignKeyColumnName; if (joinSpecification.HasChildProperty) { manyToOneForeignKeyColumnName = _conventionReader.GetManyToOneForeignKeyColumnName(joinSpecification.ChildProperty); } else { manyToOneForeignKeyColumnName = _conventionReader.GetColumnName(joinSpecification.ChildToParentForeignKeyProperty); } var joinSpec = new SqlSubQueryJoin { ChildTableName = _conventionReader.GetTableName(joinSpecification.ChildType), ParentTableName = _conventionReader.GetTableName(joinSpecification.ParentType), ChildForeignKeyColumnName = manyToOneForeignKeyColumnName, ParentPrimaryKeyColumnName = _conventionReader.GetPrimaryKeyColumnName(joinSpecification.ParentType), }; AddJoin(joinSpec, childAlias, parentAlias); ObjectRelations.Add(ObjectRelation.Create(joinSpecification, childAlias, parentAlias)); }
public Task <Empty> AddEdges(IList <Edge> edgeItems) { var relation = new ObjectRelations(); foreach (var item in edgeItems) { relation.Relations.Add(item); } var response = _client.AddEdges(relation); return(Task.FromResult(response)); }
protected static ExtendProperty RegisterProperty(Expression <Func <T, object> > propertyNameExpression, ObjectRelations relaion = ObjectRelations.Normal) { return(RegisterProperty <T>(propertyNameExpression, relaion)); }
protected static ExtendProperty RegisterProperty <TType>(Expression <Func <TType, object> > propertyNameExpression, ObjectRelations relaion = ObjectRelations.Normal) { PropertyInfo property = null; var member = propertyNameExpression.Body as MemberExpression; if (member == null) { var m = propertyNameExpression.Body as UnaryExpression; member = m.Operand as MemberExpression; } property = member.Member as PropertyInfo; if (relaion == ObjectRelations.Children) { childrenTypes.TryAdd(property.Name + "," + property.PropertyType.Name, property.PropertyType); } object defvalue = null; if (property.PropertyType.IsValueType) { defvalue = Activator.CreateInstance(property.PropertyType); } return(ExtendProperty.RegisterProperty(property.Name, property.PropertyType, typeof(TType), defvalue, null)); }