|
|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
@ -32,7 +33,7 @@ namespace EntityFrameworkCore.Jet.Metadata.Internal
|
|
|
|
|
: base(dependencies)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
|
|
|
|
|
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
|
|
|
|
|
@ -86,6 +87,26 @@ namespace EntityFrameworkCore.Jet.Metadata.Internal
|
|
|
|
|
JetAnnotationNames.Identity,
|
|
|
|
|
string.Format(CultureInfo.InvariantCulture, "{0}, {1}", seed ?? 1, increment ?? 1));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
property = column.PropertyMappings.First().Property;
|
|
|
|
|
// Only return auto increment for integer single column primary key
|
|
|
|
|
var primaryKey = property.DeclaringEntityType.FindPrimaryKey();
|
|
|
|
|
if (primaryKey != null
|
|
|
|
|
&& primaryKey.Properties.Count == 1
|
|
|
|
|
&& primaryKey.Properties[0] == property
|
|
|
|
|
&& property.ValueGenerated == ValueGenerated.OnAdd
|
|
|
|
|
&& property.ClrType.UnwrapNullableType().IsInteger()
|
|
|
|
|
&& !HasConverter(property))
|
|
|
|
|
{
|
|
|
|
|
yield return new Annotation(
|
|
|
|
|
JetAnnotationNames.Identity,
|
|
|
|
|
string.Format(CultureInfo.InvariantCulture, "{0}, {1}", 1, 1));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static bool HasConverter(IProperty property)
|
|
|
|
|
=> (property.GetValueConverter() ?? property.FindTypeMapping()?.Converter) != null;
|
|
|
|
|
}
|
|
|
|
|
}
|