public OneToOnePart(Type entity, Member property)
 {
     access        = new AccessStrategyBuilder <OneToOnePart <TOther> >(this, value => attributes.Set(x => x.Access, value));
     fetch         = new FetchTypeExpression <OneToOnePart <TOther> >(this, value => attributes.Set(x => x.Fetch, value));
     cascade       = new CascadeExpression <OneToOnePart <TOther> >(this, value => attributes.Set(x => x.Cascade, value));
     this.entity   = entity;
     this.property = property;
 }
Exemple #2
0
 protected ManyToManyPart(Type entity, Member member, Type collectionType)
     : base(entity, member, collectionType)
 {
     this.childType        = collectionType;
     this.fetch            = new FetchTypeExpression <ManyToManyPart <TChild> >(this, (Action <string>)(value => this.collectionAttributes.Set("Fetch", 2, (object)value)));
     this.notFound         = new NotFoundExpression <ManyToManyPart <TChild> >(this, (Action <string>)(value => this.relationshipAttributes.Set("NotFound", 2, (object)value)));
     this.childKeyColumns  = new ColumnMappingCollection <ManyToManyPart <TChild> >(this);
     this.parentKeyColumns = new ColumnMappingCollection <ManyToManyPart <TChild> >(this);
 }
 public ManyToOnePart(Type entity, Member property)
 {
     this.entity   = entity;
     this.property = property;
     access        = new AccessStrategyBuilder <ManyToOnePart <TOther> >(this, value => attributes.Set(x => x.Access, value));
     fetch         = new FetchTypeExpression <ManyToOnePart <TOther> >(this, value => attributes.Set(x => x.Fetch, value));
     cascade       = new CascadeExpression <ManyToOnePart <TOther> >(this, value => attributes.Set(x => x.Cascade, value));
     notFound      = new NotFoundExpression <ManyToOnePart <TOther> >(this, value => attributes.Set(x => x.NotFound, value));
 }
Exemple #4
0
        protected ManyToManyPart(Type entity, Member member, Type collectionType)
            : base(entity, member, collectionType)
        {
            this.entity = entity;
            childType   = collectionType;

            fetch    = new FetchTypeExpression <ManyToManyPart <TChild> >(this, value => collectionAttributes.Set(x => x.Fetch, value));
            notFound = new NotFoundExpression <ManyToManyPart <TChild> >(this, value => relationshipAttributes.Set(x => x.NotFound, value));
        }
        public JoinPart(string tableName)
        {
            fetch = new FetchTypeExpression <JoinPart <T> >(this, value => attributes.Set(x => x.Fetch, value));

            attributes.SetDefault(x => x.TableName, tableName);
            attributes.Set(x => x.Key, new KeyMapping {
                ContainingEntityType = typeof(T)
            });
        }
Exemple #6
0
        //PROTOTYPE1: ADDED

        public OneToOnePart(Type entity, Member member)
        {
            access      = new AccessStrategyBuilder <OneToOnePart <TOther> >(this, value => attributes.Set("Access", Layer.UserSupplied, value));
            fetch       = new FetchTypeExpression <OneToOnePart <TOther> >(this, value => attributes.Set("Fetch", Layer.UserSupplied, value));
            cascade     = new CascadeExpression <OneToOnePart <TOther> >(this, value => attributes.Set("Cascade", Layer.UserSupplied, value));
            this.entity = entity;
            this.member = member;

            SetDefaultAccess();
        }
Exemple #7
0
        protected ManyToManyPart(Type entity, Member member, Type collectionType)
            : base(entity, member, collectionType)
        {
            childType = collectionType;

            fetch    = new FetchTypeExpression <ManyToManyPart <TChild> >(this, value => collectionAttributes.Set("Fetch", Layer.UserSupplied, value));
            notFound = new NotFoundExpression <ManyToManyPart <TChild> >(this, value => relationshipAttributes.Set("NotFound", Layer.UserSupplied, value));

            childKeyColumns  = new ColumnMappingCollection <ManyToManyPart <TChild> >(this);
            parentKeyColumns = new ColumnMappingCollection <ManyToManyPart <TChild> >(this);
        }
Exemple #8
0
        protected JoinPart(string tableName, MappingProviderStore providers)
            : base(providers)
        {
            this.providers = providers;
            fetch          = new FetchTypeExpression <JoinPart <T> >(this, value => attributes.Set("Fetch", Layer.UserSupplied, value));

            attributes.Set("TableName", Layer.Defaults, tableName);
            attributes.Set("Key", Layer.Defaults, new KeyMapping {
                ContainingEntityType = typeof(T)
            });
        }
        public JoinPart(string tableName)
        {
            fetch = new FetchTypeExpression <JoinPart <T> >(this, value => attributes.Set(x => x.Fetch, value));

            keyMapping = new KeyMapping {
                ContainingEntityType = typeof(T)
            };
            keyMapping.AddDefaultColumn(new ColumnMapping {
                Name = typeof(T).Name + "_id"
            });
            attributes.SetDefault(x => x.TableName, tableName);
            attributes.Set(x => x.Key, keyMapping);
        }
        public OneToOnePart(Type entity, Member member)
        {
            access  = new AccessStrategyBuilder <OneToOnePart <TOther> >(this, value => attributes.Set("Access", Layer.UserSupplied, value));
            fetch   = new FetchTypeExpression <OneToOnePart <TOther> >(this, value => attributes.Set("Fetch", Layer.UserSupplied, value));
            cascade = new CascadeExpression <OneToOnePart <TOther> >(this, value =>
            {
                var current = attributes.Get("Cascade") as string;
                attributes.Set("Cascade", Layer.UserSupplied, current == null ? value : string.Format("{0},{1}", current, value));
            });
            this.entity = entity;
            this.member = member;

            SetDefaultAccess();
        }
Exemple #11
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)));
        }
Exemple #12
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)));
        }
        protected ManyToManyPart(Type entity, Member member, Type collectionType)
            : base(entity, member, collectionType)
        {
            this.entity = entity;
            childType   = collectionType;

            fetch    = new FetchTypeExpression <ManyToManyPart <TChild> >(this, value => collectionAttributes.Set(x => x.Fetch, value));
            notFound = new NotFoundExpression <ManyToManyPart <TChild> >(this, value => relationshipMapping.NotFound = value);

            relationshipMapping = new ManyToManyMapping
            {
                ContainingEntityType = entity
            };
            relationshipMapping.As <ManyToManyMapping>(x =>
                                                       x.AddDefaultColumn(new ColumnMapping {
                Name = typeof(TChild).Name + "_id"
            }));
        }
Exemple #14
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"
            });
        }
Exemple #15
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)));
        }