Exemplo n.º 1
0
 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));
 }
Exemplo n.º 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);
 }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        public ManyToOnePart(Type entity, Member member)
        {
            this.entity = entity;
            this.member = member;
            access      = new AccessStrategyBuilder <ManyToOnePart <TOther> >(this, value => attributes.Set("Access", Layer.UserSupplied, value));
            fetch       = new FetchTypeExpression <ManyToOnePart <TOther> >(this, value => attributes.Set("Fetch", Layer.UserSupplied, value));
            cascade     = new CascadeExpression <ManyToOnePart <TOther> >(this, value => attributes.Set("Cascade", Layer.UserSupplied, value));
            notFound    = new NotFoundExpression <ManyToOnePart <TOther> >(this, value => attributes.Set("NotFound", Layer.UserSupplied, value));

            SetDefaultAccess();
        }
Exemplo n.º 6
0
        protected OneToManyPart(Type entity, Member member, Type collectionType)
            : base(entity, member, collectionType)
        {
            this.entity = entity;
            childType   = collectionType;

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

            collectionAttributes.Set("Name", Layer.Defaults, member.Name);
        }
Exemplo n.º 7
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(x => x.Cascade, value));
            notFound   = new NotFoundExpression <OneToManyPart <TChild> >(this, value => relationshipAttributes.Set(x => x.NotFound, value));

            collectionAttributes.SetDefault(x => x.Name, member.Name);
        }
Exemplo n.º 8
0
        public ManyToOnePart(Type entity, Member member)
        {
            this.entity = entity;
            this.member = member;
            access      = new AccessStrategyBuilder <ManyToOnePart <TOther> >(this, value => attributes.Set("Access", Layer.UserSupplied, value));
            fetch       = new FetchTypeExpression <ManyToOnePart <TOther> >(this, value => attributes.Set("Fetch", Layer.UserSupplied, value));
            cascade     = new CascadeExpression <ManyToOnePart <TOther> >(this, value =>
            {
                var current = attributes.Get("Cascade") as string;
                attributes.Set("Cascade", Layer.UserSupplied, current == null ? value : string.Format("{0},{1}", current, value));
            });
            notFound = new NotFoundExpression <ManyToOnePart <TOther> >(this, value => attributes.Set("NotFound", Layer.UserSupplied, value));

            SetDefaultAccess();
        }
Exemplo n.º 9
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 =>
            {
                var current = collectionAttributes.Get("Cascade") as string;
                collectionAttributes.Set("Cascade", Layer.UserSupplied, current == null ? value : string.Format("{0},{1}", current, value));
            });
            notFound = new NotFoundExpression <OneToManyPart <TChild> >(this, value => relationshipAttributes.Set("NotFound", Layer.UserSupplied, value));

            collectionAttributes.Set("Name", Layer.Defaults, member.Name);
        }
Exemplo n.º 10
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
            };
        }
Exemplo n.º 11
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 => relationshipMapping.NotFound = value);

            relationshipMapping = new ManyToManyMapping
            {
                ContainingEntityType = entity
            };
            relationshipMapping.As <ManyToManyMapping>(x =>
                                                       x.AddDefaultColumn(new ColumnMapping {
                Name = typeof(TChild).Name + "_id"
            }));
        }
Exemplo n.º 12
0
 public KeyManyToOnePart(KeyManyToOneMapping mapping)
 {
     this.mapping = mapping;
     Access       = new AccessStrategyBuilder <KeyManyToOnePart>(this, value => mapping.Set(x => x.Access, Layer.UserSupplied, value));
     NotFound     = new NotFoundExpression <KeyManyToOnePart>(this, value => mapping.Set(x => x.NotFound, Layer.UserSupplied, value));
 }
Exemplo n.º 13
0
 public KeyManyToOnePart(KeyManyToOneMapping mapping)
 {
     this.mapping = mapping;
     Access       = new AccessStrategyBuilder <KeyManyToOnePart>(this, value => mapping.Access = value);
     NotFound     = new NotFoundExpression <KeyManyToOnePart>(this, value => mapping.NotFound = value);
 }