Comments (7)
Hello, you can't use DateTime
instead as that property is already defined using DateTimeOffset
. I'm not entirely sure but I think this can be solved by overriding OnModelCreating
in your DbContext
and manually setting up that property to use a different data type.
from mr.aspnet.identity.entityframework6.
After hours of searching I have just one idea :
modelBuilder.Properties<DateTimeOffset>()
.Configure(c => c.HasColumnType("datetime2").HasPrecision(0));
But I have always an error. I can't mark my property with [NotMapped] too.
Please, do you have a solution?
from mr.aspnet.identity.entityframework6.
What's the error?
from mr.aspnet.identity.entityframework6.
System.InvalidOperationException: The sequence contains no matching element.
à System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
à System.Data.Entity.Utilities.DbProviderManifestExtensions.GetStoreTypeFromName(DbProviderManifest providerManifest, String name)
à System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.ConfigureColumn(EdmProperty column, EntityType table, DbProviderManifest providerManifest)
à System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.Configure(EdmProperty column, EntityType table, DbProviderManifest providerManifest, Boolean allowOverride, Boolean fillFromExistingConfiguration)
à System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.<>c__DisplayClass4.<Configure>b__3(Tuple`2 pm)
à System.Data.Entity.Utilities.IEnumerableExtensions.Each[T](IEnumerable`1 ts, Action`1 action)
à System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.Configure(IEnumerable`1 propertyMappings, DbProviderManifest providerManifest, Boolean allowOverride, Boolean fillFromExistingConfiguration)
à System.Data.Entity.ModelConfiguration.Configuration.Types.StructuralTypeConfiguration.ConfigurePropertyMappings(IList`1 propertyMappings, DbProviderManifest providerManifest, Boolean allowOverride)
à System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.ConfigurePropertyMappings(DbDatabaseMapping databaseMapping, EntityType entityType, DbProviderManifest providerManifest, Boolean allowOverride)
à System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.Configure(EntityType entityType, DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest)
à System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.ConfigureEntityTypes(DbDatabaseMapping databaseMapping, ICollection`1 entitySets, DbProviderManifest providerManifest)
à System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.Configure(DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest)
à System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)
à System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
à System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
à System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
à System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
à System.Data.Entity.Internal.LazyInternalContext.get_ModelBeingInitialized()
à System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer)
à System.Data.Entity.Utilities.DbContextExtensions.<>c__DisplayClass1.<GetModel>b__0(XmlWriter w)
à System.Data.Entity.Utilities.DbContextExtensions.GetModel(Action`1 writeXml)
à System.Data.Entity.Utilities.DbContextExtensions.GetModel(DbContext context)
à System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext, DatabaseExistenceState existenceState, Boolean calledByCreateDatabase)
à System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration)
à System.Data.Entity.Migrations.Design.MigrationScaffolder..ctor(DbMigrationsConfiguration migrationsConfiguration)
à Migrator.EF6.Program.Executor.AddMigration(String name)
à Migrator.EF6.Program.<>c__DisplayClass0_4.<Main>b__15()
à Microsoft.Dnx.Runtime.Common.CommandLine.CommandLineApplication.Execute(String[] args)
à Migrator.EF6.Program.Main(String[] args)
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
à Microsoft.Dnx.ApplicationHost.Program.<>c__DisplayClass3_0.<ExecuteMain>b__0()
à System.Threading.Tasks.Task`1.InnerInvoke()
à System.Threading.Tasks.Task.Execute()
from mr.aspnet.identity.entityframework6.
If I add "datetime" in palce of "datetime2" i have an error of MySql convertion on the Migration Add.
You don't have any way to modify this mapping or change the property type ?
A magic ovveride of this type :( ?
Thanks a lot
from mr.aspnet.identity.entityframework6.
I'm not sure why this is not working when you manually tell it to use datetime2
. You can try to fork this and simply change the LockoutEnd
property's type to DateTime
instead as a last resort.
from mr.aspnet.identity.entityframework6.
I'm closing this, please reopen if you still have issues.
from mr.aspnet.identity.entityframework6.
Related Issues (14)
- Update to new version of Identity HOT 12
- Possible issue with 2FA HOT 26
- FindByIdAsync in UserStore takes 'string' Ids by default (even when inherited from UserStoreInt) HOT 2
- Package version 3.0.2 HOT 4
- Sample or concise documentation for setting up User Store- Getting TypeLoadException while setting up User Store HOT 1
- IdentityUser constructor should initialize the Tokens property HOT 3
- ASP.NET RTM Compatibility HOT 3
- Production Use HOT 2
- Change Key type to int HOT 8
- Ambiguous call between AspNetCore.Identity.IdentityBuilder and MR.AspNet.Identity.EntityFramework6.IdentityEntityFrameworkExtensions.AddEntityFrameworkStores<TContext> HOT 2
- PasswordSignInAsync hangs (deadlock?) HOT 9
- TUser Constraint violation problem when running aspnet core app HOT 12
- please assist with adding claims when a user is authenticated. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mr.aspnet.identity.entityframework6.