Issue Details (XML | Word | Printable)

Key: DNET-750
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Critical Critical
Assignee: Jiri Cincura
Reporter: Roberto Carlos da Silva
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
.NET Data provider

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

Created: 04/Apr/17 07:52 PM   Updated: 06/Apr/17 02:58 PM
Component/s: Entity Framework
Affects Version/s: 5.8.0.0
Fix Version/s: None

File Attachments: 1. Zip Archive TestaSite.zip (5.18 MB)

Environment:
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


 Description  « Hide

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'.


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Roberto Carlos da Silva added a comment - 04/Apr/17 08:04 PM
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.

Jiri Cincura added a comment - 05/Apr/17 05:49 AM
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.

Roberto Carlos da Silva added a comment - 06/Apr/17 02:58 PM
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.