示例#1
0
        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)));
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
0
        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);
            });
        }