private Expression GetByIdExpression <T>(T aData) where T : class, new() { ClassMap <T> classmap = Loader.GetClassMap <T>(); IdentityMap identity = classmap.Identity; return(ExpressionHelper.Eq( identity.GetColumn(), ValueExtractor.GetValue(identity.Member.Name, aData))); }
private void AppendMember <T>(List <Property> aMembers, PropertyMap aMap, T aData, bool isBindNull) where T : class, new() { object value = extractor.GetValue(aMap.Member.Name, aData); if (!isBindNull && value == null) { return; } aMembers.Add(new Property(aMap.GetColumn(), value)); }
protected override T Binding(SqlDataReader aReader) { T data = new T(); PropertyBinder.BindProperty <T>( delegate(PropertyMap aMap) { BindValue(aMap, aReader, data); }, delegate(IdentityMap aMap) { BindValue(aMap, aReader, data); }, delegate(PropertyMap aMap, MemberInfo[] aWrapperParents) { var field = ValueExtractor.GetValue(data, aWrapperParents); BindValue(aMap, aReader, field); } ); return(data); }
internal InsertUpdateQuery(PropertyBinder aBinder, T aData, bool isNullBind, ValueExtractor anExtractor) : base(aBinder) { ValueBinder valuebinder = Database.Current.Factory.GetValueBinder(); aBinder.BindProperty <T>( delegate(PropertyMap aMap) { valuebinder.BindValue(query.GetStatement(), aMap, aData, isNullBind); }, delegate(IdentityMap aMap) { setIdentity(aMap.GetColumn()); }, delegate(PropertyMap aMap, MemberInfo[] aParentsMembers) { var field = anExtractor.GetValue(aData, aParentsMembers); valuebinder.BindValue(query.GetStatement(), aMap, field, isNullBind); }); }