コード例 #1
0
        OneToManyPart <TChild> HasMany <TChild>(Member member)
        {
            //PROTOTYPE1: ADDED
            var part = providers.Collections.OfType <OneToManyPart <TChild> >().FirstOrDefault(p => p.Property.Name == member.Name);

            if (part == null)
            {
                //PROTOTYPE1: ADDED

                OnMemberMapped(member);

                part = new OneToManyPart <TChild>(EntityType, member);

                //PROTOTYPE1: ADDED
                if (this.UseBackingField(member.Name))
                {
                    part.Access.CamelCaseField(Prefix.Underscore);
                }
                //PROTOTYPE1: ADDED

                providers.Collections.Add(part);

                //PROTOTYPE1: ADDED
            }
            //PROTOTYPE1: ADDED

            return(part);
        }
コード例 #2
0
        private OneToManyPart <TChild> HasMany <TChild>(Member member)
        {
            this.OnMemberMapped(member);
            OneToManyPart <TChild> oneToManyPart = new OneToManyPart <TChild>(this.EntityType, member);

            this.providers.Collections.Add((ICollectionMappingProvider)oneToManyPart);
            return(oneToManyPart);
        }
コード例 #3
0
        protected virtual OneToManyPart <TChild> HasMany <TChild>(Member member)
        {
            var part = new OneToManyPart <TChild>(EntityType, member);

            collections.Add(part);

            return(part);
        }
コード例 #4
0
        OneToManyPart <TChild> HasMany <TChild>(Member member)
        {
            OnMemberMapped(member);

            var part = new OneToManyPart <TChild>(EntityType, member);

            providers.Collections.Add(part);

            return(part);
        }
コード例 #5
0
        /// <summary>
        /// 一对多配置,适用新框架(不级联更新)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="part"></param>
        /// <param name="keyColumn">字段</param>
        /// <param name="orderBy">排序表达式 : createtime desc,可空</param>
        /// <returns></returns>
        public static OneToManyPart <T> Config <T>(this OneToManyPart <T> part, string keyColumn, string orderBy = "")
        {
            var p = part
                    .KeyColumn(keyColumn)
                    .LazyLoad()
                    .Fetch.Select()
                    .Inverse()
                    .Cascade.None();

            if (!String.IsNullOrEmpty(orderBy))
            {
                p = p.OrderBy(orderBy);
            }

            return(p);
        }