public override IObjectActivatorCreator GenarateObjectActivatorCreator(DbSqlQueryExpression sqlQuery) { int ordinal; ordinal = ObjectModelHelper.TryGetOrAddColumn(sqlQuery, this.Expression).Value; PrimitiveObjectActivatorCreator activatorCreator = new PrimitiveObjectActivatorCreator(this.ObjectType, ordinal); activatorCreator.CheckNullOrdinal = ObjectModelHelper.TryGetOrAddColumn(sqlQuery, this.NullChecking); return(activatorCreator); }
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); }