Hi, i dont know if this is a task of the Entity Framework or the dotConnect Provider:
I have a problem with Generating my Oracle tables via code first.
Referenced tables are generated correctly with the Add-Migration functionality. (Initial Migration)
Non-Referenced tables are missing in the generated Migration. I always have to make a reference to another table. But of course there are control tables without any reference, so any idea what is the solution here ?
Thanks.
EF6 Code First
-
- Posts: 16
- Joined: Mon 22 Jun 2015 08:38
Re: EF6 Code First
Ok i still dont know if this is based on a dotconnect bug or entityframework but i could solve it by adding an extra line with the fluent api to the OnModelCreating method
it was not possible to force the generation with data annotation
Code: Select all
modelBuilder.Entity<TABLENAME>().ToTable("TABLENAME");
Code: Select all
[Table("TABLENAME")]
Re: EF6 Code First
This code creates the TABLENAME table in the database:
If this doesn't help to fix the problem, please send us a small test project for reproducing the issue you have encountered.
Code: Select all
namespace ConsoleApplication {
class Program {
static void Main(string[] args) {
var monitor = new Devart.Data.Oracle.OracleMonitor() { IsActive = true };
using (var context = new MyDbContext()) {
context.Database.Initialize(false);
}
}
}
class MyDbContext : DbContext {
public MyDbContext()
: base(new Devart.Data.Oracle.OracleConnection("server=***;uid=***;pwd=***;"), true) { }
static MyDbContext() {
DbConfiguration.SetConfiguration(new Devart.Data.Oracle.Entity.OracleEntityProviderServicesConfiguration());
}
DbSet<MyClass> myClasses { get; set; }
}
[System.ComponentModel.DataAnnotations.Schema.Table("TABLENAME")]
class MyClass {
public int Id { get; set; }
public string data { get; set; }
}
}
-
- Posts: 16
- Joined: Mon 22 Jun 2015 08:38
Re: EF6 Code First
I tried the "Table"-tag but it didn´t work.
Re: EF6 Code First
Have you tried running our code (without changes, except connection string) in the brand new test project? Notify us about the result.