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

Does Abp .net core suport mysql database? #2267

Closed
coolshun opened this issue Jun 29, 2017 · 23 comments
Closed

Does Abp .net core suport mysql database? #2267

coolshun opened this issue Jun 29, 2017 · 23 comments
Labels
Milestone

Comments

@coolshun
Copy link

HI,
Does Abp .net core suport mysql database?

Thanks!

@hikalkan
Copy link
Member

We are using EF Core. I haven't tried but there is a MySQL driver as I know.

@coolshun
Copy link
Author

coolshun commented Jun 29, 2017

@hikalkan I use Mysql instead of Sqlite by MySql.Data.EntityFrameworkCore,but it throw the exception bellow.

Nested transactions are not supported.

   at MySql.Data.MySqlClient.MySqlConnection.BeginTransaction(IsolationLevel iso)
   at MySql.Data.MySqlClient.MySqlConnection.BeginDbTransaction(IsolationLevel isolationLevel)
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionWithNoPreconditions(IsolationLevel isolationLevel)
   at Abp.EntityFrameworkCore.Uow.DbContextEfCoreTransactionStrategy.CreateDbContext[TDbContext](String connectionString, IDbContextResolver dbContextResolver) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp.EntityFrameworkCore\EntityFrameworkCore\Uow\DbContextEfCoreTransactionStrategy.cs:line 38
   at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.GetOrCreateDbContext[TDbContext](Nullable`1 multiTenancySide) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp.EntityFrameworkCore\EntityFrameworkCore\Uow\EfCoreUnitOfWork.cs:line 116
   at Abp.EntityFrameworkCore.Uow.UnitOfWorkExtensions.GetDbContext[TDbContext](IActiveUnitOfWork unitOfWork, Nullable`1 multiTenancySide) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp.EntityFrameworkCore\EntityFrameworkCore\Uow\UnitOfWorkExtensions.cs:line 38
   at Abp.EntityFrameworkCore.Uow.UnitOfWorkDbContextProvider`1.GetDbContext(Nullable`1 multiTenancySide) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp.EntityFrameworkCore\EntityFrameworkCore\Uow\UnitOfWorkDbContextProvider.cs:line 33
   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.get_Context() in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp.EntityFrameworkCore\EntityFrameworkCore\Repositories\EfCoreRepositoryBaseOfTEntityAndTPrimaryKey.cs:line 31
   at Castle.Proxies.Invocations.EfCoreRepositoryBase`3_get_Context_1.InvokeMethodOnTarget()
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 55
   at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 47
   at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 36
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.PersonRepositoryProxy.get_Context()
   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.get_Table() in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp.EntityFrameworkCore\EntityFrameworkCore\Repositories\EfCoreRepositoryBaseOfTEntityAndTPrimaryKey.cs:line 36
   at Castle.Proxies.Invocations.EfCoreRepositoryBase`3_get_Table_1.InvokeMethodOnTarget()
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 55
   at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 47
   at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 36
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.PersonRepositoryProxy.get_Table()
   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.GetAllIncluding(Expression`1[] propertySelectors) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp.EntityFrameworkCore\EntityFrameworkCore\Repositories\EfCoreRepositoryBaseOfTEntityAndTPrimaryKey.cs:line 56
   at Castle.Proxies.Invocations.EfCoreRepositoryBase`3_GetAllIncluding_1.InvokeMethodOnTarget()
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 55
   at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 47
   at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 36
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.PersonRepositoryProxy.GetAllIncluding(Expression`1[] propertySelectors)
   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.GetAll() in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp.EntityFrameworkCore\EntityFrameworkCore\Repositories\EfCoreRepositoryBaseOfTEntityAndTPrimaryKey.cs:line 51
   at Castle.Proxies.Invocations.EfCoreRepositoryBase`3_GetAll_1.InvokeMethodOnTarget()
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 55
   at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 47
   at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 36
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.PersonRepositoryProxy.GetAll()
   at Abp.Domain.Repositories.AbpRepositoryBase`2.GetAllList() in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Repositories\AbpRepositoryBase.cs:line 51
   at Castle.Proxies.Invocations.AbpRepositoryBase`2_GetAllList_2.InvokeMethodOnTarget()
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 55
   at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 47
   at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 36
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.PersonRepositoryProxy.GetAllList()
   at Abp.EntityFrameworkCore.Tests.Tests.Repository_Tests.Should_Get_Initial_Persons() in E:\work\OpenSrc\aspnetboilerplate-dev\aspnetboilerplate-dev\test\Abp.EntityFrameworkCore.Tests\Tests\Repository_Tests.cs:line 32

@ismcagdas
Copy link
Member

ismcagdas commented Jun 29, 2017

@hikalkan
Copy link
Member

Where is this unit test (Should_Get_Initial_Persons)? ABP's source code does not contain such a test.

@coolshun
Copy link
Author

coolshun commented Jun 29, 2017

@hikalkan the Person class is created by me.

 public class Person:Entity<string>
    {
        public virtual string Name { get; set; }
    }

@hikalkan
Copy link
Member

Beside unit tests, can you try with a real application too?

@coolshun
Copy link
Author

@hikalkan yes,It is same with "Blog","Post".

@coolshun
Copy link
Author

@hikalkan I remember that the "UnitOfWork" using a single Transaction in your source code,but what's the "Nested transactions"?

@hikalkan
Copy link
Member

Yes, it should be single transaction. I wondered why stack trace goes to UnitOfWorkInterceptor.PerformSyncUow that much. We should investigate it.

@coolshun
Copy link
Author

coolshun commented Jun 29, 2017

@hikalkan Do you need me to give you the Zip file of source code? May be of help to you.

  var builder = new DbContextOptionsBuilder<BloggingDbContext>();

            builder.ReplaceService<IEntityMaterializerSource, AbpEntityMaterializerSource>();

            //var inMemorySqlite = new SqliteConnection("Data Source=:memory:");
            //builder.UseSqlite(inMemorySqlite);
            //using MySQL.Data.EntityFrameworkCore.Extensions;
            builder.UseMySQL("Server=localhost;Database=Bloeng;Uid=root;Pwd=*****;");




             iocManager.IocContainer.Register(
                Component
                    .For<DbContextOptions<BloggingDbContext>>()
                    .Instance(builder.Options)
                    .LifestyleSingleton()
            );

            //inMemorySqlite.Open();
            new BloggingDbContext(builder.Options).Database.EnsureCreated();`

@hikalkan
Copy link
Member

Yes, it can help. But if you only changed the code above no need.

@hikalkan hikalkan added problem and removed question labels Jun 29, 2017
@hikalkan hikalkan added this to the v2.2 milestone Jun 29, 2017
@coolshun
Copy link
Author

@hikalkan The others is simple calasses like "Person","PersonRepository",so you no need it .I'm waiting for your result.Thanks!

@Caskia
Copy link

Caskia commented Jun 29, 2017

I am migrating my project to net core with mysql, not find this problem.

@coolshun
Copy link
Author

@Caskia May I have the project files you migrated?可以给我看一下你的代码么?qq:908790392

@coolshun
Copy link
Author

@hikalkan I create a Multi Page Web Application from your website ,and set it by mysql,and execute "Add-Migration InitialCreate" command ,but it throw a exception bellow.

The entity type 'EditionFeatureSetting' is part of a hierarchy, but does not have a discriminator property configured.

namespace ABP_MPA.EntityFrameworkCore { public static class ABP_MPADbContextConfigurer { public static void Configure(DbContextOptionsBuilder<ABP_MPADbContext> builder, string connectionString) { //builder.UseSqlServer(connectionString); builder.UseMySQL(connectionString); } } }

PM> Add-Migration InitialCreate System.InvalidOperationException: The entity type 'EditionFeatureSetting' is part of a hierarchy, but does not have a discriminator property configured. at Microsoft.EntityFrameworkCore.Internal.ModelValidator.ShowError(String message) at Microsoft.EntityFrameworkCore.Internal.RelationalModelValidator.ValidateDiscriminator(IEntityType entityType) at Microsoft.EntityFrameworkCore.Internal.RelationalModelValidator.ValidateDiscriminatorValues(IEntityType rootEntityType) at Microsoft.EntityFrameworkCore.Internal.RelationalModelValidator.ValidateInheritanceMapping(IModel model) at Microsoft.EntityFrameworkCore.Internal.RelationalModelValidator.Validate(IModel model) at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel() at Microsoft.EntityFrameworkCore.Internal.LazyRef1.get_Value()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.b__0(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.b__0(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String name, String outputDir, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_01.<Execute>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) The entity type 'EditionFeatureSetting' is part of a hierarchy, but does not have a discriminator property configured. PM>

@Caskia
Copy link

Caskia commented Jun 30, 2017

@coolshun I can send you a template with mysql.

@ismcagdas
Copy link
Member

Hi @coolshun,

Pomelo does not have this error as far as I know but if you don't want to use it you need to configure EF TPH model configuration in OnModelCreating of your DbContext, for example:

modelBuilder.Entity<FeatureSetting>(b =>
{
    b.HasDiscriminator<string>("Discriminator")
        .HasValue<FeatureSetting>(nameof(FeatureSetting))
        .HasValue<EditionFeatureSetting>(nameof(EditionFeatureSetting))
        .HasValue<TenantFeatureSetting>(nameof(TenantFeatureSetting));
});

modelBuilder.Entity<PermissionSetting>(b =>
{
    b.HasDiscriminator<string>("Discriminator")
        .HasValue<PermissionSetting>(nameof(PermissionSetting))
        .HasValue<RolePermissionSetting>(nameof(RolePermissionSetting))
        .HasValue<UserPermissionSetting>(nameof(UserPermissionSetting));
});

@coolshun
Copy link
Author

@ismcagdas Thank you, but it throws another exception bellow.
System.InvalidOperationException: No mapping to a relational type can be found for property 'Abp.Notifications.UserNotificationInfo.TenantNotificationId' with the CLR type 'Guid'. at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapperExtensions.GetMapping(IRelationalTypeMapper typeMapper, IProperty property) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.<Diff>d__35.MoveNext() at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.<DiffCollection>d__561.MoveNext()
at System.Linq.Enumerable.ConcatIterator1.MoveNext() at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.<Diff>d__27.MoveNext() at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.<DiffCollection>d__561.MoveNext()
at System.Linq.Enumerable.ConcatIterator1.MoveNext() at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.Sort(IEnumerable1 operations, DiffContext diffContext)
at Microsoft.EntityFrameworkCore.Migrations.Design.MigrationsScaffolder.ScaffoldMigration(String migrationName, String rootNamespace, String subNamespace)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String name, String outputDir, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_01.<Execute>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) No mapping to a relational type can be found for property 'Abp.Notifications.UserNotificationInfo.TenantNotificationId' with the CLR type 'Guid'.

@coolshun
Copy link
Author

@hikalkan I create a Multi Page Web Application without ZERO from your website ,and set it by mysql,and create a "Person" enity class,but it still throws the exception bellow when I run it.
1.InvalidOperationException: Nested transactions are not supported.
2.InvalidOperationException: Connection must be valid and open to commit transaction

InvalidOperationException: Nested transactions are not supported. MySql.Data.MySqlClient.MySqlConnection.Throw(Exception ex) MySql.Data.MySqlClient.MySqlConnection.BeginTransaction(IsolationLevel iso) Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionWithNoPreconditions(IsolationLevel isolationLevel) Abp.EntityFrameworkCore.Uow.DbContextEfCoreTransactionStrategy.CreateDbContext<TDbContext>(string connectionString, IDbContextResolver dbContextResolver) Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.GetOrCreateDbContext<TDbContext>(Nullable<MultiTenancySides> multiTenancySide) Castle.Proxies.EfCoreRepositoryBase3Proxy.get_Context_callback()
Castle.Proxies.Invocations.EfCoreRepositoryBase3_get_Context.InvokeMethodOnTarget() Castle.DynamicProxy.AbstractInvocation.Proceed() Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) Castle.DynamicProxy.AbstractInvocation.Proceed() Castle.Proxies.EfCoreRepositoryBase3Proxy.get_Context()
Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase.get_Table()
Castle.Proxies.Invocations.EfCoreRepositoryBase3_get_Table.InvokeMethodOnTarget() Castle.DynamicProxy.AbstractInvocation.Proceed() Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) Castle.DynamicProxy.AbstractInvocation.Proceed() Castle.Proxies.EfCoreRepositoryBase3Proxy.get_Table()
Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase.GetAllIncluding(Expression1[] propertySelectors) Castle.Proxies.Invocations.EfCoreRepositoryBase3_GetAllIncluding.InvokeMethodOnTarget()
Castle.DynamicProxy.AbstractInvocation.Proceed()
Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options)
Castle.DynamicProxy.AbstractInvocation.Proceed()
Castle.Proxies.EfCoreRepositoryBase3Proxy.GetAllIncluding(Expression1[] propertySelectors)
Castle.Proxies.EfCoreRepositoryBase3Proxy.GetAll_callback() Castle.Proxies.Invocations.EfCoreRepositoryBase3_GetAll.InvokeMethodOnTarget()
Castle.DynamicProxy.AbstractInvocation.Proceed()
Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options)
Castle.DynamicProxy.AbstractInvocation.Proceed()
Castle.Proxies.EfCoreRepositoryBase`3Proxy.GetAll()
ABP_MPA_NoZero.PersonAppService.GetPersons() in PersonAppService .cs

        _personRepository = personRepository;
    }

    public IQueryable<Person> GetPersons()
    {
        //调用Task仓储的特定方法GetAllWithPeople
        var persons = _personRepository.GetAll();
       
        return persons;
    }

    public void InsertPerson(Person entity)
    {

Castle.Proxies.Invocations.IPersonAppService_GetPersons.InvokeMethodOnTarget()
Castle.DynamicProxy.AbstractInvocation.Proceed()
Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options)
Castle.DynamicProxy.AbstractInvocation.Proceed()
Abp.Auditing.AuditingInterceptor.PerformSyncAuditing(IInvocation invocation, AuditInfo auditInfo)
Castle.DynamicProxy.AbstractInvocation.Proceed()
Castle.DynamicProxy.AbstractInvocation.Proceed()
Castle.Proxies.PersonAppServiceProxy.GetPersons()
ABP_MPA_NoZero.Web.Controllers.HomeController.Persons() in HomeController.cs

    {
        return View();
    }

    public ActionResult Persons()
    {
        IQueryable < Person > ps =  _personAppService.GetPersons();
        
        return View(ps.ToList());
    }

    public ActionResult NewPerson()
    {

lambda_method(Closure , object , Object[] )
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__27.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__25.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__24.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ExceptionContext context)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__22.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__20.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Builder.RouterMiddleware+d__4.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware+d__5.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware+d__6.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware+d__6.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware+d__7.MoveNext()`

Next Next Next Next Next Next Next Next Next Next

InvalidOperationException: Connection must be valid and open to commit transaction MySql.Data.MySqlClient.MySqlTransaction.Commit() Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.Commit() Abp.EntityFrameworkCore.Uow.DbContextEfCoreTransactionStrategy.Commit() Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.CommitTransaction() Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork+<CompleteUowAsync>d__14.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Abp.Domain.Uow.UnitOfWorkBase+<CompleteAsync>d__56.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter+<OnActionExecutionAsync>d__3.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+<InvokeNextActionFilterAsync>d__25.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+<InvokeNextExceptionFilterAsync>d__24.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ExceptionContext context) Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+<InvokeNextResourceFilter>d__22.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context) Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+<InvokeAsync>d__20.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Microsoft.AspNetCore.Builder.RouterMiddleware+<Invoke>d__4.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware+<Invoke>d__5.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware+<Invoke>d__6.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware+<Invoke>d__6.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware+<Invoke>d__7.MoveNext()

@coolshun
Copy link
Author

@hikalkan How do I give you the source code?

@coolshun
Copy link
Author

@hikalkan I use Pomelo.EntityFrameworkCore.MySql,It It works well.

@AlanFlaherty
Copy link

AlanFlaherty commented Jun 30, 2017

If you delete all the migrations in the migrations folder and create an initial migration against the MySql database when you are setting the project up, dotnet ef should work against MySql with Pomelo.EntityFrameworkCore.MySql.

@hikalkan
Copy link
Member

It was long to read, shall I close this if it's OK?

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

No branches or pull requests

5 participants