> I try the ordinary EF CodeFirst test with latest packages for new FB3.
> 
> <packages>
>   <package id="EntityFramework" version="6.1.3" targetFramework="net452" />
>   <package id="EntityFramework.Firebird" version="4.10.0.0" 
> targetFramework="net452" />
>   <package id="FirebirdSql.Data.FirebirdClient" version="4.10.0.0" 
> targetFramework="net452" />
> </packages>
> 
> ---------------------
> 
> public class Blog
>   {
>     public int      id        { get; set; }
>     public string   name      { get; set; }
>     public DateTime created   { get; set; }
>     public string   comment   { get; set; }
> 
>     public virtual List<Post> posts { get; set; }
>   }
> 
>   public class Post
>   {
>     public int id { get; set; }
>     public string content { get; set; }
> 
>     public int blogId { get; set; }
> 
>     public virtual Blog blog { get; set; }
>   }
> 
> ....
> 
>   public TestContext()
>         : base(connection, true)
>     {
> 
>     }
> 
>     public DbSet<Blog> Blog { get; set; }
>     public DbSet<Post> Posts { get; set; }
>   }
> 
> ...
> 
> Database.SetInitializer(new MigrateDatabaseToLatestVersion<TestContext, 
> Configuration>());
> 
> -------------------------------------
> 
> This code creates this table definition:
> 
> CREATE TABLE "Posts"
> (
>   "id" Integer NOT NULL,
>   "content" Blob sub_type 1,
>   "blogId" Integer NOT NULL,
>   CONSTRAINT "PK_Posts" PRIMARY KEY ("id")
> );
> ALTER TABLE "Posts" ADD CONSTRAINT "FK_Posts_Blogs_blogId"
>   FOREIGN KEY ("blogId") REFERENCES "Blogs" ("id") ON DELETE CASCADE;
> CREATE INDEX "IX_Posts_blogId" ON "Posts" ("blogId");
> GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
>  ON "Posts" TO  SYSDBA WITH GRANT OPTION;
> 
> ----------------------------------------
> 
> BUT: why is created a "IX_Posts_blogId" index when the 
> "FK_Posts_Blogs_blogId" index created for FK?

There are databases out there, e.g. MS SQL Server, which do not create an index 
for FK constraints behind the scene.

I'm not really into the .NET world or EF in particular, but I wonder if the 
code responsible for creating the DDL is something in the Firebird .NET 
provider or EF in general.



--
With regards,
Thomas Steinmaurer
http://www.upscene.com

Professional Tools and Services for Firebird
FB TraceManager, IB LogManager, Database Health Check, Tuning etc.

  • [firebird-su... 'e...@emel.hu' e...@emel.hu [firebird-support]
    • Re: [fi... 'Thomas Steinmaurer' t...@iblogmanager.com [firebird-support]
    • Re: [fi... Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
      • Re:... kristinwens...@yahoo.com [firebird-support]

Reply via email to