Schema specified is not valid. MySql.

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
fmacedoo
Posts: 5
Joined: Fri 03 May 2013 20:11

Schema specified is not valid. MySql.

Post by fmacedoo » Fri 03 May 2013 20:29

Hi,

I'm using dotConnect for MySql on my project and get a error when System.Data.Entity.MigrateDatabaseToLatestVersion.InitializeDatabase runs.

Exception details down:

Code: Select all

[MetadataException: Schema specified is not valid. Errors: 
(0,0) : error 0040: The Type longblob is not qualified with a namespace or alias. Only primitive types can be used without qualification.]
   System.Data.Entity.Core.Metadata.Edm.Loader.ThrowOnNonWarningErrors() +85
   System.Data.Entity.Core.Metadata.Edm.Loader.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths) +203
   System.Data.Entity.Core.Metadata.Edm.Loader..ctor(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, Boolean throwOnError, IDbDependencyResolver resolver) +177
   System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError, IDbDependencyResolver resolver, DbProviderManifest& providerManifest, DbProviderFactory& providerFactory, String& providerInvariantName, String& providerManifestToken, Memoizer`2& cachedCTypeFunction) +167
   System.Data.Entity.Core.Metadata.Edm.StoreItemCollection..ctor(IEnumerable`1 xmlReaders) +311
   System.Data.Entity.Utilities.XDocumentExtensions.GetStoreItemCollection(XDocument model, DbProviderInfo& providerInfo) +247
   System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(XDocument sourceModel, XDocument targetModel, Nullable`1 includeSystemOperations) +430
   System.Data.Entity.Migrations.DbMigrator.ApplyMigration(DbMigration migration, DbMigration lastMigration) +577
   System.Data.Entity.Migrations.Infrastructure.MigratorBase.ApplyMigration(DbMigration migration, DbMigration lastMigration) +56
   System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId) +192
   System.Data.Entity.Migrations.Infrastructure.MigratorBase.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId) +59
   System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration) +887
   System.Data.Entity.Migrations.<>c__DisplayClass19.<Update>b__18() +38
   System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase) +344
   System.Data.Entity.Migrations.Infrastructure.MigratorBase.EnsureDatabaseExists(Action mustSucceedToKeepDatabase) +42
   System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration) +145
   System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update() +33
   System.Data.Entity.MigrateDatabaseToLatestVersion`2.InitializeDatabase(TContext context) +154
   System.Data.Entity.Internal.<>c__DisplayClassc`1.<CreateInitializationAction>b__b() +165
   System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +110

[DataException: An exception occurred while initializing the database. See the InnerException for details.]
   System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +166
   System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +669
   System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c) +31
   System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +143
   System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +270
   System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() +123
   System.Data.Entity.Internal.InternalContext.Initialize() +42
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +39
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +138
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +38
   System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +84
   System.Linq.Queryable.SingleOrDefault(IQueryable`1 source, Expression`1 predicate) +63
   MyApp.Model.DAO.UserDAO.Select(String login) +98
   MyApp.Model.BI.UserBI.Get(String login) +111
   MyApp.UI.Util.AuthUtility.Authenticate(String userLogin) +28
   MyApp.UI.BaseApplication`2.Application_AuthenticateRequest(Object sender, EventArgs e) +40
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

fmacedoo
Posts: 5
Joined: Fri 03 May 2013 20:11

Re: Schema specified is not valid. MySql.

Post by fmacedoo » Mon 06 May 2013 19:21

The same issue occurs with the dotConnect for PostgreSQL.

Schema specified is not valid. Errors:
(0,0) : error 0040: The Type bytea is not qualified with a namespace or alias. Only primitive types can be used without qualification.

Some solution for this?

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: Schema specified is not valid. MySql.

Post by Shalex » Tue 07 May 2013 14:12

Entity Framework supports only primitive types: http://msdn.microsoft.com/en-us/library/ee382832.aspx. From the Entity Framework's point of view, bytea and longblob are not primitive types. You can work with these data types via plain ADO.NET.

fmacedoo
Posts: 5
Joined: Fri 03 May 2013 20:11

Re: Schema specified is not valid. MySql.

Post by fmacedoo » Tue 07 May 2013 15:25

I'm using code first aproach. I can't use properties of type byte[]? On MSSQLServer, i can use properties of this type normally.

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: Schema specified is not valid. MySql.

Post by Shalex » Wed 15 May 2013 15:22

fmacedoo wrote:I can't use properties of type byte[]?
Sorry for the mistake in my previous post. Actually byte[] is a primitive type and it can be mapped to longblob (MySQL) and bytea (PostgreSQL).
fmacedoo wrote:(0,0) : error 0040: The Type bytea (longblob) is not qualified with a namespace or alias. Only primitive types can be used without qualification.
We cannot reproduce the problem in our environment using the latest (x.226) builds of dotConnect for MySQL and dotConnect for PostgreSQL. Please send us a small test project for reproducing.

Here is the easiest way to check the workability:
1. Add Devart Entity Model in your test project with DbContext template.
2. Set template's properties: Fluent Mapping=True; Database Independent=True.
3. The Metadata Artifact Processing property of the model should be set to Do Not Generate Mapping Files.
4. Model Settings > Synchronization > Mapping > select the "Enable automatic synchronization of storage part and mapping of the model with its conceptual part" option.
5. Set your connection string either to MySQL or to PostgreSQL via Database Explorer - Entity Developer (it will save the connection string to app.config).
6. Implement Model-First approach to create an entity with the byte[] property.
7. Save the model and try using its class in runtime.
Notify us about the result.

We recommend using the dbMonitor tool for tracing the database activity:
http://www.devart.com/dotconnect/mysql/ ... nitor.html
http://www.devart.com/dbmonitor/dbmon3.exe

fmacedoo
Posts: 5
Joined: Fri 03 May 2013 20:11

Re: Schema specified is not valid. MySql.

Post by fmacedoo » Thu 16 May 2013 03:11

Thanks for your attention Shalex. I will check these procedures and go back with more details.

Post Reply