-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Comments
We are using EF Core. I haven't tried but there is a MySQL driver as I know. |
@hikalkan I use Mysql instead of Sqlite by MySql.Data.EntityFrameworkCore,but it throw the exception bellow. Nested transactions are not supported.
|
@coolshun you can try this one for MySql https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql |
Where is this unit test (Should_Get_Initial_Persons)? ABP's source code does not contain such a test. |
@hikalkan the Person class is created by me. public class Person:Entity<string>
{
public virtual string Name { get; set; }
} |
Beside unit tests, can you try with a real application too? |
@hikalkan yes,It is same with "Blog","Post". |
@hikalkan I remember that the "UnitOfWork" using a single Transaction in your source code,but what's the "Nested transactions"? |
Yes, it should be single transaction. I wondered why stack trace goes to UnitOfWorkInterceptor.PerformSyncUow that much. We should investigate it. |
@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();` |
Yes, it can help. But if you only changed the code above no need. |
@hikalkan The others is simple calasses like "Person","PersonRepository",so you no need it .I'm waiting for your result.Thanks! |
I am migrating my project to net core with mysql, not find this problem. |
@Caskia May I have the project files you migrated?可以给我看一下你的代码么?qq:908790392 |
@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.
|
@coolshun I can send you a template with mysql. |
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:
|
@ismcagdas Thank you, but it throws another exception bellow. |
@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.
|
@hikalkan How do I give you the source code? |
@hikalkan I use Pomelo.EntityFrameworkCore.MySql,It It works well. |
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. |
It was long to read, shall I close this if it's OK? |
HI,
Does Abp .net core suport mysql database?
Thanks!
The text was updated successfully, but these errors were encountered: