Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is not possible do command: Update-Database to migrate database on package manager console [DNET750] #692

Closed
firebird-automations opened this issue Apr 4, 2017 · 8 comments

Comments

@firebird-automations
Copy link

Submitted by: Roberto Carlos da Silva (robertosistemas)

Attachments:
TestaSite.zip

PM> Update-Database -Verbose
Using StartUp project 'TestaSite.EntityFramework'.
Using NuGet project 'TestaSite.EntityFramework'.
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
System.NotSupportedException: There is no store type corresponding to the EDM type 'Edm.Byte' of primitive type 'Byte'.
at FirebirdSql.Data.EntityFramework6.FbProviderManifest.GetStoreType(TypeUsage edmType) in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbProviderManifest.cs:line 417
at System.Data.Entity.ModelConfiguration.Edm.Services.StructuralTypeMappingGenerator.MapTableColumn(EdmProperty property, String columnName, Boolean isInstancePropertyOnDerivedType)
at System.Data.Entity.ModelConfiguration.Edm.Services.PropertyMappingGenerator.Generate(EntityType entityType, IEnumerable`1 properties, EntitySetMapping entitySetMapping, MappingFragment entityTypeMappingFragment, IList`1 propertyPath, Boolean createNewColumn)
at System.Data.Entity.ModelConfiguration.Edm.Services.TableMappingGenerator.Generate(EntityType entityType, DbDatabaseMapping databaseMapping)
at System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.GenerateEntityTypes(DbDatabaseMapping databaseMapping)
at System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.Generate(EdmModel conceptualModel)
at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.ForceOSpaceLoadingForKnownEntityTypes()
at System.Data.Entity.DbContext.System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext()
at Abp.EntityFramework.AbpDbContext.RegisterToChanges()
at Abp.Zero.EntityFramework.AbpZeroDbContext`3..ctor(String nameOrConnectionString)
at TestaSite.EntityFramework.TestaSiteDbContext..ctor() in C:\arquivos\TestaSite\TestaSite.EntityFramework\EntityFramework\TestaSiteDbContext.cs:line 20
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Data.Entity.Infrastructure.DbContextInfo.CreateInstance()
at System.Data.Entity.Infrastructure.DbContextInfo..ctor(Type contextType, DbProviderInfo modelProviderInfo, AppConfig config, DbConnectionInfo connectionInfo, Func`1 resolver)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext, DatabaseExistenceState existenceState, Boolean calledByCreateDatabase)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration)
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.Run()
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force)
at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)

There is no store type corresponding to the EDM type 'Edm.Byte' of primitive type 'Byte'.

@firebird-automations
Copy link
Author

Modified by: Roberto Carlos da Silva (robertosistemas)

environment: Visual Studio 2015
FirebirdSql.Data.FirebirdClient 5.8.0.0
EntityFramework.Firebird 5.8.0.0
aspnetboilerplate with Module Zero v1.5.2

=>

Visual Studio 2015
Firebird 2.5.7
FirebirdSql.Data.FirebirdClient 5.8.0.0
EntityFramework.Firebird 5.8.0.0
aspnetboilerplate with Module Zero v1.5.2

@firebird-automations
Copy link
Author

Modified by: Roberto Carlos da Silva (robertosistemas)

summary: is not possible applay command: Update-Database to migrate database on package manager console => is not possible do command: Update-Database to migrate database on package manager console

@firebird-automations
Copy link
Author

Commented by: Roberto Carlos da Silva (robertosistemas)

Attached project to reproduce error.
Also follows the database.
You need to configure the connection string in the project: TestaSite.EntityFramework
Try doing Upgrade-Database -Verbose on this project.

@firebird-automations
Copy link
Author

Modified by: Roberto Carlos da Silva (robertosistemas)

Attachment: TestaSite.zip [ 13086 ]

@firebird-automations
Copy link
Author

Modified by: Roberto Carlos da Silva (robertosistemas)

environment: Visual Studio 2015
Firebird 2.5.7
FirebirdSql.Data.FirebirdClient 5.8.0.0
EntityFramework.Firebird 5.8.0.0
aspnetboilerplate with Module Zero v1.5.2

=>

Visual Studio 2015
Firebird 3.0.2
FirebirdSql.Data.FirebirdClient 5.8.0.0
EntityFramework.Firebird 5.8.0.0
aspnetboilerplate with Module Zero v1.5.2

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Your model contains `byte` field (I spotted i.e. field using AbpLoginResultType enum), which is not supported by Firebird (it is in the exception, BTW). Either change the type or the mapping.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Author

Commented by: Roberto Carlos da Silva (robertosistemas)

I do mapping on dbcontext like this:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.HasDefaultSchema("");

    modelBuilder\.Properties\(\)\.Where\(p =\> p\.PropertyType == typeof\(byte\)\)
        \.Configure\(p =\> p\.HasColumnType\("smallint"\)\);

    modelBuilder\.Properties\(\)\.Where\(p =\> p\.PropertyType == typeof\(Abp\.BackgroundJobs\.BackgroundJobPriority\)\)
        \.Configure\(p =\> p\.HasColumnType\("smallint"\)\);

    modelBuilder\.Properties\(\)\.Where\(p =\> p\.PropertyType == typeof\(Abp\.Notifications\.NotificationSeverity\)\)
        \.Configure\(p =\> p\.HasColumnType\("smallint"\)\);

    modelBuilder\.Properties\(\)\.Where\(p =\> p\.PropertyType == typeof\(Abp\.Authorization\.Users\.AbpLoginResultType\)\)
        \.Configure\(p =\> p\.HasColumnType\("smallint"\)\);

    modelBuilder\.Entity<Abp\.BackgroundJobs\.BackgroundJobInfo\>\(\)\.Property\(p =\> p\.Priority\)\.HasColumnType\("smallint"\);
    modelBuilder\.Entity<Abp\.Notifications\.NotificationInfo\>\(\)\.Property\(p =\> p\.Severity\)\.HasColumnType\("smallint"\);
    modelBuilder\.Entity<Abp\.Notifications\.TenantNotificationInfo\>\(\)\.Property\(p =\> p\.Severity\)\.HasColumnType\("smallint"\);
    modelBuilder\.Entity<Abp\.Notifications\.TenantNotification\>\(\)\.Property\(p =\> p\.Severity\)\.HasColumnType\("smallint"\);
    modelBuilder\.Entity<Abp\.Authorization\.Users\.UserLoginAttempt\>\(\)\.Property\(p =\> p\.Result\)\.HasColumnType\("smallint"\);

    base\.OnModelCreating\(modelBuilder\);

\}

But it still does not work.
Would you have any suggestions?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants