Beispiel #1
0
 private InternalPropertyBuilder InternalProperty(Type propertyType, string name, bool shadowProperty, ConfigurationSource configurationSource)
 {
     return(_propertyBuilders.GetOrAdd(
                () => Metadata.TryGetProperty(name),
                () => Metadata.AddProperty(name, propertyType, shadowProperty),
                property => new InternalPropertyBuilder(property, ModelBuilder, configurationSource),
                configurationSource));
 }
 private InternalPropertyBuilder InternalProperty(Type propertyType, string propertyName, bool shadowProperty, ConfigurationSource configurationSource)
 {
     return(CanAdd(propertyName, configurationSource)
         ? _propertyBuilders.GetOrAdd(
                () => Metadata.TryGetProperty(propertyName),
                () => Metadata.AddProperty(propertyName, propertyType, shadowProperty),
                (property, isNew) => new InternalPropertyBuilder(property, ModelBuilder, configurationSource),
                configurationSource)
         : null);
 }
Beispiel #3
0
            public virtual PropertyBuilder Property <TProperty>(
                [NotNull] string name, bool shadowProperty = false, bool concurrencyToken = false)
            {
                Check.NotEmpty(name, "name");

                var property
                    = Metadata.TryGetProperty(name)
                      ?? Metadata.AddProperty(name, typeof(TProperty), shadowProperty, concurrencyToken);

                return(new PropertyBuilder(property));
            }
                public IndexBuilder Index([NotNull] Expression <Func <TEntity, object> > indexExpression)
                {
                    Check.NotNull(indexExpression, "indexExpression");

                    var properties
                        = indexExpression.GetPropertyAccessList()
                          .Select(pi => Metadata.TryGetProperty(pi.Name) ?? Metadata.AddProperty(pi))
                          .ToArray();
                    var index = Metadata.AddIndex(properties);

                    return(new IndexBuilder(index, ModelBuilder));
                }
Beispiel #5
0
        private InternalPropertyBuilder InternalProperty(Type propertyType, string propertyName, bool shadowProperty, ConfigurationSource configurationSource)
        {
            if (CanAdd(propertyName, isNavigation: false, configurationSource: configurationSource))
            {
                if (_ignoredProperties.HasValue)
                {
                    _ignoredProperties.Value.Remove(propertyName);
                }

                return(_propertyBuilders.GetOrAdd(
                           () => Metadata.TryGetProperty(propertyName),
                           () => Metadata.AddProperty(propertyName, propertyType, shadowProperty),
                           property => new InternalPropertyBuilder(property, ModelBuilder, configurationSource),
                           configurationSource));
            }

            return(null);
        }
        public InternalPropertyBuilder Property(MemberInfo memberInfo)
        {
            var property = Metadata.AddProperty(memberInfo);

            return(new InternalPropertyBuilder(property, new InternalModelBuilder(Metadata.Model)));
        }