Exemplo n.º 1
0
        public void ApplyMapping(ConventionModelMapper mapper)
        {
            mapper.IsPersistentProperty((member, declared) => {
                var property = member as PropertyInfo;

                if (property == null || !property.CanRead)
                {
                    return(false);
                }

                if (IsIdentityProperty(property))
                {
                    return(false);
                }

                if (property.ReflectedType.GetProperty(property.Name, BindingFlags.Instance | BindingFlags.Public) == null)
                {
                    return(false);
                }

                if (!ignoredPropertiesProvider.ShouldMapProperty(property))
                {
                    return(false);
                }

                return(true);
            });

            mapper.BeforeMapProperty += (modelInspector, member, propertyCustomizer) => {
                propertyCustomizer.Column(formatter.GetColumnName(member.LocalMember));
            };
        }
Exemplo n.º 2
0
        void MapRelationship(ConventionModelMapper mapper)
        {
            mapper.Class <Relationship>(map => {
                map.Discriminator(d => {
                    d.Column(nameFormatter.GetColumnName(Reflect.Property <Relationship>(x => x.Type)));
                });

                map.Property(p => p.Behaviour, m => {
                    m.Type <JsonSerializedType <RelationshipBehaviour> >(new { AllowNull = Boolean.FalseString });
                });
            });
        }