Example #1
0
        public void Map(ClassMappingBase classMap, Member member)
        {
            if (member.DeclaringType != classMap.Type)
            {
                return;
            }

            var collectionType = CollectionTypeResolver.Resolve(member);
            var mapping        = CollectionMapping.For(collectionType);

            mapping.ContainingEntityType = classMap.Type;
            mapping.Member = member;
            mapping.Set(x => x.Name, Layer.Defaults, member.Name);
            SetDefaultAccess(member, mapping);

            keys.SetKey(member, classMap, mapping);
            SetElement(member, classMap, mapping);

            classMap.AddCollection(mapping);
        }
Example #2
0
        public void Map(ClassMappingBase classMap, Member member)
        {
            if (member.DeclaringType != classMap.Type)
            {
                return;
            }

            var collectionType = CollectionTypeResolver.Resolve(member);
            var mapping        = CollectionMapping.For(collectionType);

            mapping.ContainingEntityType = classMap.Type;
            mapping.Member = member;
            mapping.Set(x => x.Name, Layer.Defaults, member.Name);
            mapping.Set(x => x.ChildType, Layer.Defaults, member.PropertyType.GetGenericArguments()[0]);

            SetDefaultAccess(member, mapping);
            SetRelationship(member, classMap, mapping);
            keys.SetKey(member, classMap, mapping);

            classMap.AddCollection(mapping);
        }
        public void Map(ClassMappingBase classMap, Member member)
        {
            if (member.DeclaringType != classMap.Type)
            {
                return;
            }

            var mapping = collections.CreateCollectionMapping(member.PropertyType);

            mapping.ContainingEntityType = classMap.Type;
            mapping.Member = member;
            mapping.SetDefaultValue(x => x.Name, member.Name);

            if (member.IsProperty && !member.CanWrite)
            {
                mapping.Access = cfg.GetAccessStrategyForReadOnlyProperty(member).ToString();
            }

            keys.SetKey(member, classMap, mapping);
            SetElement(member, classMap, mapping);

            classMap.AddCollection(mapping);
        }