public IConfiguration Discover(EdmProperty property, DbModel model) { Debug.Assert(property != null, "property is null."); Debug.Assert(model != null, "model is null."); var columnProperty = model.GetColumn(property); if (property.IsKey() && _identityKeyTypes.Contains(property.PrimitiveType.PrimitiveTypeKind)) { if (columnProperty.IsStoreGeneratedIdentity) { // By convention return(null); } } else if (columnProperty.IsTimestamp()) { // By convention return(null); } else if (columnProperty.StoreGeneratedPattern == StoreGeneratedPattern.None) { // Doesn't apply return(null); } return(new DatabaseGeneratedConfiguration { StoreGeneratedPattern = columnProperty.StoreGeneratedPattern }); }
public override IConfiguration Discover(EdmProperty property, DbModel model) { Debug.Assert(property != null, "property is null."); Debug.Assert(model != null, "model is null."); if (!_lengthTypes.Contains(property.PrimitiveType.PrimitiveTypeKind)) { // Doesn't apply return(null); } if (property.IsMaxLength || !property.MaxLength.HasValue || (property.MaxLength.Value == 128 && property.IsKey())) { // By convention return(null); } var configuration = property.PrimitiveType.PrimitiveTypeKind == PrimitiveTypeKind.String ? new MaxLengthStringConfiguration() : new MaxLengthConfiguration(); configuration.MaxLength = property.MaxLength.Value; return(configuration); }
public IConfiguration Discover(EdmProperty property, DbModel model) { Debug.Assert(property != null, "property is null."); Debug.Assert(model != null, "model is null."); if (property.Nullable || property.PrimitiveType.ClrEquivalentType.IsValueType || property.IsKey() || model.GetColumn(property).IsTimestamp()) { // By convention return(null); } return(new RequiredConfiguration()); }