c# - EF Fluent API + two column composite uniqueness + autoincrement primary key -


  1. I use Fluent API I do not like comments.

  2. I always want to use an automation as my primary key, in all my tables.

  3. My columns require two columns, X and Y (where x is not the key of the orientation and the Y is not an auto key key), i.e.: not another line It can have X1 = X2 and Y1 = Y2 If I was not using an autoincrement key, then I would just create the keys of these two in this way:

      modelbuilder Entity & lt; Foo & gt; () .HasKey (t = & gt; new {tX, TI}). Takelet ("FOS");   

    But, as I said in (2), I am using Auto Correction Primary Key

      modelbuilder.Entity & lt; Foo & gt; () .HasKey (t = & gt; t.SomeLongId) .ToTable ("Foos"); How can I achieve this overall specificity in the Fluent API?  

    I want to get it written in SQL:

      create tab 'fuse' (`id 'large (20) unknown call entanglement, ... primary key (`Id`), unique key (` x`, `y ')); You can get it and apply it using the 'HasColumnAnnotation (...)' method.    

      modelbuilder.Entity & lt; Foo & gt; (). Property (t = & gt; tx). Callman Annotation ("X", New Index Annotation (New Index Accruiter ("X") {ICU = True});   

    You can find more information

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -