public IObjectActivatorCreator GenarateObjectActivatorCreator(DbSqlQueryExpression sqlQuery) { int ordinal; ordinal = MappingObjectExpressionHelper.TryGetOrAddColumn(sqlQuery, this._exp).Value; MappingField mf = new MappingField(this._type, ordinal); mf.CheckNullOrdinal = MappingObjectExpressionHelper.TryGetOrAddColumn(sqlQuery, this.NullChecking); return(mf); }
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); }