Page 1 of 1
EF6 Code First
Posted: Thu 30 Jul 2015 09:25
by christian_bertram
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.
Re: EF6 Code First
Posted: Thu 30 Jul 2015 14:12
by christian_bertram
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
Code: Select all
modelBuilder.Entity<TABLENAME>().ToTable("TABLENAME");
it was not possible to force the generation with data annotation
Re: EF6 Code First
Posted: Fri 31 Jul 2015 16:22
by Shalex
This code creates the TABLENAME table in the database:
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; }
}
}
If this doesn't help to fix the problem, please
send us a small test project for reproducing the issue you have encountered.
Re: EF6 Code First
Posted: Mon 03 Aug 2015 11:33
by christian_bertram
I tried the "Table"-tag but it didn“t work.
Re: EF6 Code First
Posted: Mon 03 Aug 2015 13:15
by Shalex
Have you tried running our code (without changes, except connection string) in the brand new test project? Notify us about the result.