public override IObjectActivatorCreator GenarateObjectActivatorCreator(DbSqlQueryExpression sqlQuery) { IObjectActivatorCreator elementActivatorCreator = this.ElementModel.GenarateObjectActivatorCreator(sqlQuery); CollectionObjectActivatorCreator ret = new CollectionObjectActivatorCreator(this._collectionType, this.OwnerType, elementActivatorCreator); return(ret); }
public IObjectActivatorCreator GenarateObjectActivatorCreator(DbSqlQueryExpression sqlQuery) { MappingEntity mappingEntity = new MappingEntity(this.ConstructorDescriptor); foreach (var kv in this.MappingConstructorParameters) { ParameterInfo pi = kv.Key; DbExpression exp = kv.Value; int ordinal; ordinal = MappingObjectExpressionHelper.TryGetOrAddColumn(sqlQuery, exp, pi.Name).Value; if (exp == this.NullChecking) { mappingEntity.CheckNullOrdinal = ordinal; } mappingEntity.ConstructorParameters.Add(pi, ordinal); } foreach (var kv in this.ComplexConstructorParameters) { ParameterInfo pi = kv.Key; IMappingObjectExpression val = kv.Value; IObjectActivatorCreator complexMappingMember = val.GenarateObjectActivatorCreator(sqlQuery); mappingEntity.ConstructorEntityParameters.Add(pi, complexMappingMember); } foreach (var kv in this.MappingMembers) { MemberInfo member = kv.Key; DbExpression exp = kv.Value; int ordinal; ordinal = MappingObjectExpressionHelper.TryGetOrAddColumn(sqlQuery, exp, member.Name).Value; if (exp == this.NullChecking) { mappingEntity.CheckNullOrdinal = ordinal; } mappingEntity.MappingMembers.Add(member, ordinal); } foreach (var kv in this.ComplexMembers) { MemberInfo member = kv.Key; IMappingObjectExpression val = kv.Value; IObjectActivatorCreator complexMappingMember = val.GenarateObjectActivatorCreator(sqlQuery); mappingEntity.ComplexMembers.Add(kv.Key, complexMappingMember); } if (mappingEntity.CheckNullOrdinal == null) { mappingEntity.CheckNullOrdinal = MappingObjectExpressionHelper.TryGetOrAddColumn(sqlQuery, this.NullChecking); } return(mappingEntity); }
public IObjectActivatorCreator GenarateObjectActivatorCreator(DbSqlQueryExpression sqlQuery) { ComplexObjectActivatorCreator activatorCreator = new ComplexObjectActivatorCreator(this.ConstructorDescriptor); foreach (var kv in this.PrimitiveConstructorParameters) { ParameterInfo pi = kv.Key; DbExpression exp = kv.Value; int ordinal; ordinal = ObjectModelHelper.TryGetOrAddColumn(sqlQuery, exp, pi.Name).Value; if (exp == this.NullChecking) { activatorCreator.CheckNullOrdinal = ordinal; } activatorCreator.ConstructorParameters.Add(pi, ordinal); } foreach (var kv in this.ComplexConstructorParameters) { ParameterInfo pi = kv.Key; IObjectModel val = kv.Value; IObjectActivatorCreator complexMappingMember = val.GenarateObjectActivatorCreator(sqlQuery); activatorCreator.ConstructorComplexParameters.Add(pi, complexMappingMember); } foreach (var kv in this.PrimitiveMembers) { MemberInfo member = kv.Key; DbExpression exp = kv.Value; int ordinal; ordinal = ObjectModelHelper.TryGetOrAddColumn(sqlQuery, exp, member.Name).Value; if (exp == this.NullChecking) { activatorCreator.CheckNullOrdinal = ordinal; } activatorCreator.PrimitiveMembers.Add(member, ordinal); } foreach (var kv in this.ComplexMembers) { IObjectActivatorCreator complexMemberActivatorCreator = kv.Value.GenarateObjectActivatorCreator(sqlQuery); activatorCreator.ComplexMembers.Add(kv.Key, complexMemberActivatorCreator); } foreach (var kv in this.CollectionMembers) { IObjectActivatorCreator collectionMemberActivatorCreator = kv.Value.GenarateObjectActivatorCreator(sqlQuery); activatorCreator.CollectionMembers.Add(kv.Key, collectionMemberActivatorCreator); } if (activatorCreator.CheckNullOrdinal == null) { activatorCreator.CheckNullOrdinal = ObjectModelHelper.TryGetOrAddColumn(sqlQuery, this.NullChecking); } return(activatorCreator); }
public IObjectActivatorCreator GenarateObjectActivatorCreator(DbSqlQueryExpression sqlQuery) { List <DbColumnSegment> columnList = sqlQuery.ColumnSegments; MappingEntity mappingEntity = new MappingEntity(this.ConstructorDescriptor); MappingObjectExpression mappingMembers = this; foreach (var kv in this.ConstructorParameters) { ParameterInfo pi = kv.Key; DbExpression exp = kv.Value; int ordinal; ordinal = MappingObjectExpressionHelper.TryGetOrAddColumn(sqlQuery, exp, pi.Name).Value; if (exp == this.NullChecking) { mappingEntity.CheckNullOrdinal = ordinal; } mappingEntity.ConstructorParameters.Add(pi, ordinal); } foreach (var kv in mappingMembers.ConstructorEntityParameters) { ParameterInfo pi = kv.Key; IMappingObjectExpression val = kv.Value; IObjectActivatorCreator navMappingMember = val.GenarateObjectActivatorCreator(sqlQuery); mappingEntity.ConstructorEntityParameters.Add(pi, navMappingMember); } foreach (var kv in mappingMembers.SelectedMembers) { MemberInfo member = kv.Key; DbExpression exp = kv.Value; int ordinal; ordinal = MappingObjectExpressionHelper.TryGetOrAddColumn(sqlQuery, exp, member.Name).Value; if (exp == this.NullChecking) { mappingEntity.CheckNullOrdinal = ordinal; } mappingEntity.Members.Add(member, ordinal); } foreach (var kv in mappingMembers.SubResultEntities) { MemberInfo member = kv.Key; IMappingObjectExpression val = kv.Value; IObjectActivatorCreator navMappingMember = val.GenarateObjectActivatorCreator(sqlQuery); mappingEntity.EntityMembers.Add(kv.Key, navMappingMember); } if (mappingEntity.CheckNullOrdinal == null) { mappingEntity.CheckNullOrdinal = MappingObjectExpressionHelper.TryGetOrAddColumn(sqlQuery, this.NullChecking); } return(mappingEntity); }
public CollectionObjectActivatorCreator(Type collectionType, Type ownerType, IObjectActivatorCreator elementActivatorCreator) { this.CollectionType = collectionType; this.OwnerType = ownerType; this.ElementActivatorCreator = elementActivatorCreator; }