static ICollectionRelationshipMapping CreateManyToMany(Member property, Type child, Type parent)
        {
            var mapping = new ManyToManyMapping
            {
                ContainingEntityType = parent
            };

            mapping.Set(x => x.Class, Layer.Defaults, new TypeReference(property.PropertyType.GetGenericArguments()[0]));

            var columnMapping = new ColumnMapping();

            columnMapping.Set(x => x.Name, Layer.Defaults, child.Name + "_id");
            mapping.AddColumn(Layer.Defaults, columnMapping);

            return(mapping);
        }
示例#2
0
        protected override ICollectionRelationshipMapping GetRelationship()
        {
            ManyToManyMapping manyToManyMapping = new ManyToManyMapping(this.relationshipAttributes.Clone())
            {
                ContainingEntityType = this.EntityType
            };

            if (this.isTernary && this.valueType != (Type)null)
            {
                manyToManyMapping.Set <TypeReference>((Expression <Func <ManyToManyMapping, TypeReference> >)(x => x.Class), 0, new TypeReference(this.valueType));
            }
            foreach (IFilterMappingProvider filterMappingProvider in (IEnumerable <IFilterMappingProvider>) this.childFilters)
            {
                manyToManyMapping.ChildFilters.Add(filterMappingProvider.GetFilterMapping());
            }
            return((ICollectionRelationshipMapping)manyToManyMapping);
        }
示例#3
0
        protected override ICollectionRelationshipMapping GetRelationship()
        {
            var mapping = new ManyToManyMapping(relationshipAttributes.Clone())
            {
                ContainingEntityType = EntityType,
            };

            if (isTernary && valueType != null)
            {
                mapping.Set(x => x.Class, Layer.Defaults, new TypeReference(valueType));
            }

            foreach (var filterPart in childFilters)
            {
                mapping.ChildFilters.Add(filterPart.GetFilterMapping());
            }

            return(mapping);
        }
 public void CustomClass(Type type)
 {
     mapping.Set(x => x.Class, Layer.Conventions, new TypeReference(type));
 }