コード例 #1
0
        protected OneToManyPart(Type entity, Member member, Type collectionType)
            : base(entity, member, collectionType)
        {
            this.entity = entity;
            childType   = collectionType;

            keyColumns = new ColumnMappingCollection <OneToManyPart <TChild> >(this);
            cascade    = new CollectionCascadeExpression <OneToManyPart <TChild> >(this, value => collectionAttributes.Set("Cascade", Layer.UserSupplied, value));
            notFound   = new NotFoundExpression <OneToManyPart <TChild> >(this, value => relationshipAttributes.Set("NotFound", Layer.UserSupplied, value));

            collectionAttributes.Set("Name", Layer.Defaults, member.Name);
        }
コード例 #2
0
        protected OneToManyPart(Type entity, Member member, Type collectionType)
            : base(entity, member, collectionType)
        {
            this.entity = entity;
            childType   = collectionType;

            cascade  = new CollectionCascadeExpression <OneToManyPart <TChild> >(this, value => collectionAttributes.Set(x => x.Cascade, value));
            notFound = new NotFoundExpression <OneToManyPart <TChild> >(this, value => relationshipMapping.NotFound = value);

            collectionAttributes.SetDefault(x => x.Name, member.Name);

            relationshipMapping = new OneToManyMapping
            {
                ContainingEntityType = entity
            };
        }
コード例 #3
0
        protected ToManyBase(Type entity, Member member, Type type)
        {
            this.entity = entity;
            this.member = member;
            AsBag();
            access         = new AccessStrategyBuilder <T>((T)this, value => collectionAttributes.Set(x => x.Access, value));
            fetch          = new FetchTypeExpression <T>((T)this, value => collectionAttributes.Set(x => x.Fetch, value));
            optimisticLock = new OptimisticLockBuilder <T>((T)this, value => collectionAttributes.Set(x => x.OptimisticLock, value));
            cascade        = new CollectionCascadeExpression <T>((T)this, value => collectionAttributes.Set(x => x.Cascade, value));

            SetDefaultCollectionType(type);
            SetCustomCollectionType(type);
            Cache = new CachePart(entity);

            collectionAttributes.SetDefault(x => x.Name, member.Name);
            relationshipAttributes.SetDefault(x => x.Class, new TypeReference(typeof(TChild)));
        }
コード例 #4
0
        //PROTOTYPE1: ADDED

        protected ToManyBase(Type entity, Member member, Type type)
        {
            this.entity = entity;
            this.member = member;
            AsBag();
            access         = new AccessStrategyBuilder <T>((T)this, value => collectionAttributes.Set("Access", Layer.UserSupplied, value));
            fetch          = new FetchTypeExpression <T>((T)this, value => collectionAttributes.Set("Fetch", Layer.UserSupplied, value));
            optimisticLock = new OptimisticLockBuilder <T>((T)this, value => collectionAttributes.Set("OptimisticLock", Layer.UserSupplied, value));
            cascade        = new CollectionCascadeExpression <T>((T)this, value => collectionAttributes.Set("Cascade", Layer.UserSupplied, value));

            SetDefaultCollectionType();
            SetCustomCollectionType(type);
            SetDefaultAccess();
            Cache = new CachePart(entity);

            collectionAttributes.Set("Name", Layer.Defaults, member.Name);
            relationshipAttributes.Set("Class", Layer.Defaults, new TypeReference(typeof(TChild)));
        }
コード例 #5
0
        protected ToManyBase(Type entity, Member member, Type type)
        {
            this.entity = entity;
            this.member = member;
            AsBag();
            access         = new AccessStrategyBuilder <T>((T)this, value => collectionAttributes.Set(x => x.Access, value));
            fetch          = new FetchTypeExpression <T>((T)this, value => collectionAttributes.Set(x => x.Fetch, value));
            optimisticLock = new OptimisticLockBuilder <T>((T)this, value => collectionAttributes.Set(x => x.OptimisticLock, value));
            cascade        = new CollectionCascadeExpression <T>((T)this, value => collectionAttributes.Set(x => x.Cascade, value));

            SetDefaultCollectionType(type);
            SetCustomCollectionType(type);

            collectionAttributes.SetDefault(x => x.Name, member.Name);

            keyMapping = new KeyMapping();
            keyMapping.AddDefaultColumn(new ColumnMapping {
                Name = entity.Name + "_id"
            });
        }
コード例 #6
0
        protected ToManyBase(Type entity, Member member, Type type)
        {
            this.entity = entity;
            this.member = member;
            AsBag();
            access  = new AccessStrategyBuilder <T>((T)this, value => collectionAttributes.Set("Access", Layer.UserSupplied, value));
            fetch   = new FetchTypeExpression <T>((T)this, value => collectionAttributes.Set("Fetch", Layer.UserSupplied, value));
            cascade = new CollectionCascadeExpression <T>((T)this, value =>
            {
                var current = collectionAttributes.Get("Cascade") as string;
                collectionAttributes.Set("Cascade", Layer.UserSupplied, current == null ? value : string.Format("{0},{1}", current, value));
            });

            SetDefaultCollectionType();
            SetCustomCollectionType(type);
            SetDefaultAccess();
            Cache = new CachePart(entity);

            collectionAttributes.Set("Name", Layer.Defaults, member.Name);
            relationshipAttributes.Set("Class", Layer.Defaults, new TypeReference(typeof(TChild)));
        }