diff --git a/DbContext_EFv6.txt b/DbContext_EFv6.txt
index 2305f26..6c2662e 100644
--- a/DbContext_EFv6.txt
+++ b/DbContext_EFv6.txt
@@ -1,4 +1,6 @@
using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
@@ -20,7 +22,7 @@ namespace @Model.Namespace {
@EndEach
@Each.EntityType
- [Table("@Current.Name")]
+ [Table("@Current.Name", Schema = "@Current.Schema")]
public class @Current.Name {
public @Current.Name() {
@Each.NavigationProperty
@@ -32,7 +34,7 @@ namespace @Model.Namespace {
@Each.Property
@If.Identity
- [Key]
+ [Key][Column(Order = @Current.Order)]
@EndIf
public @Current.TypeSigned @Current.Name { get; set; }
@EndEach
diff --git a/EdmGen06.csproj b/EdmGen06.csproj
index e318da1..4e65cbe 100644
--- a/EdmGen06.csproj
+++ b/EdmGen06.csproj
@@ -89,6 +89,7 @@
+
@@ -119,6 +120,9 @@
+
+
+
PreserveNewest
@@ -135,9 +139,9 @@
-
+
-
-
+
+
\ No newline at end of file
diff --git a/EdmGen06.sln b/EdmGen06.sln
index 7726874..78bbb8d 100644
--- a/EdmGen06.sln
+++ b/EdmGen06.sln
@@ -37,7 +37,6 @@ Global
{B9B34ACB-3CB7-4B76-937E-C74141C40E3A}.Debug-net45|Any CPU.ActiveCfg = Debug-net45-EF4|Any CPU
{B9B34ACB-3CB7-4B76-937E-C74141C40E3A}.Debug-net45|Any CPU.Build.0 = Debug-net45-EF4|Any CPU
{B9B34ACB-3CB7-4B76-937E-C74141C40E3A}.Debug-net45-EF6|Any CPU.ActiveCfg = Debug-net45-EF6|Any CPU
- {B9B34ACB-3CB7-4B76-937E-C74141C40E3A}.Debug-net45-EF6|Any CPU.Build.0 = Debug-net45-EF6|Any CPU
{B9B34ACB-3CB7-4B76-937E-C74141C40E3A}.Release|Any CPU.ActiveCfg = Release-net45-EF6|Any CPU
{B9B34ACB-3CB7-4B76-937E-C74141C40E3A}.Release|Any CPU.Build.0 = Release-net45-EF6|Any CPU
{B9B34ACB-3CB7-4B76-937E-C74141C40E3A}.Release-net45|Any CPU.ActiveCfg = Release-net45-EF4|Any CPU
diff --git a/EdmGenClassGen.cs b/EdmGenClassGen.cs
index 9cd99dc..0c8fe36 100644
--- a/EdmGenClassGen.cs
+++ b/EdmGenClassGen.cs
@@ -56,7 +56,7 @@ public void CodeFirstGen(String fpEdmx, String fpcs, String generator) {
SortedDictionary dAssoc = new SortedDictionary();
List alAssoc = new List();
var Alias = Schema.Attribute("Alias").Value;
- var Namespace= Schema.Attribute("Namespace").Value;
+ var Namespace = Schema.Attribute("Namespace").Value;
foreach (var Association in Schema.Elements(nsCSDL + "Association")) {
var Name = Association.Attribute("Name").Value;
var assoc12 = new Assoc(Association, nsCSDL, true);
@@ -169,6 +169,8 @@ public String RelationshipMultiplicity2 {
}
String CheckTypeSigned(String edmType, bool nullable) {
+ if (edmType == "Time")
+ edmType = "TimeSpan";
if (nullable && "/Boolean/Int16/Int32/Int64/Guid/Single/Double/Decimal/DateTime/DateTimeOffset/Time/".IndexOf("/" + edmType + "/") >= 0)
edmType += "?";
if (edmType == "Binary")
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
index 791ebe8..52c5c2a 100644
--- a/Properties/Resources.Designer.cs
+++ b/Properties/Resources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// このコードはツールによって生成されました。
-// ランタイム バージョン:4.0.30319.18052
+// ランタイム バージョン:4.0.30319.42000
//
// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
// コードが再生成されるときに損失したりします。
@@ -80,19 +80,101 @@ internal static byte[] ConceptualSchemaDefinitionVersion3 {
}
}
+ ///
+ /// using System;
+ ///using System.Data.Entity;
+ ///using System.Data.Entity.Infrastructure;
+ ///
+ ///namespace @Model.Namespace {
+ ///@Each.EntityContainer
+ /// public class @Current.Name : DbContext {
+ /// public @Current.Name(): base("name=@Current.Name") {
+ ///
+ /// }
+ ///
+ /// protected override void OnModelCreating(DbModelBuilder modelBuilder) {
+ /// throw new UnintentionalCodeFirstException();
+ /// }
+ ///
+ ///@Each.EntitySet
+ /// public DbSet<@Current.EntityType> @Current.Name { get; set; }
+ ///@EndEach
+ /// }
+ ///@EndEach
+ ///
+ ///@Eac [残りの文字列は切り詰められました]"; に類似しているローカライズされた文字列を検索します。
+ ///
+ internal static string DbContext_EFv5 {
+ get {
+ return ResourceManager.GetString("DbContext_EFv5", resourceCulture);
+ }
+ }
+
+ ///
+ /// using System;
+ ///using System.Data.Entity;
+ ///using System.Data.Entity.Infrastructure;
+ ///
+ ///namespace @Model.Namespace {
+ ///@Each.EntityContainer
+ /// public class @Current.Name : DbContext {
+ /// public @Current.Name(): base("name=@Current.Name") {
+ ///
+ /// }
+ ///
+ /// protected override void OnModelCreating(DbModelBuilder modelBuilder) {
+ /// throw new UnintentionalCodeFirstException();
+ /// }
+ ///
+ ///@Each.EntitySet
+ /// public virtual DbSet<@Current.EntityType> @Current.Name { get; set; }
+ ///@EndEach
+ /// }
+ ///@EndEach [残りの文字列は切り詰められました]"; に類似しているローカライズされた文字列を検索します。
+ ///
+ internal static string DbContext_EFv6 {
+ get {
+ return ResourceManager.GetString("DbContext_EFv6", resourceCulture);
+ }
+ }
+
+ ///
+ /// using System;
+ ///using System.ComponentModel;
+ ///using System.Data.Entity.Core.EntityClient;
+ ///using System.Data.Entity.Core.Objects;
+ ///using System.Data.Entity.Core.Objects.DataClasses;
+ ///using System.Linq;
+ ///using System.Runtime.Serialization;
+ ///using System.Xml.Serialization;
+ ///
+ ///[assembly: EdmSchemaAttribute()]
+ ///#region EDM Relationship Metadata
+ ///@Each.Association
+ ///[assembly: EdmRelationshipAttribute(
+ /// "@Model.Namespace",
+ /// "@Current.Name",
+ /// "@Current.Role1",
+ /// System.Data.Entity.Core.Metadata.Edm.Relati [残りの文字列は切り詰められました]"; に類似しているローカライズされた文字列を検索します。
+ ///
+ internal static string ObjectContext {
+ get {
+ return ResourceManager.GetString("ObjectContext", resourceCulture);
+ }
+ }
+
///
/// EdmGen06
/// /ModelGen <connectionString> <providerName> <modelName> <targetSchema> <ver>
/// /EFModelGen <connectionString> <providerName> <DbProviderServices> <modelName> <targetSchema> <ver>
+ /// /EFCodeFirstGen <input.edmx> <output.cs> <generator>
/// /DataSet <connectionString> <providerName> <modelName> <targetSchema>
/// /DataSet.cs <DataSet1.xsd> <DataSet1.cs>
///
- ///rem [SqlServer Example]
+ ///rem <ver> is ssdl/msl/csdl schema version: 1.0 or 3.0
+ ///rem <generator>: DbContext.EFv6 or DbContext.EFv5 or ObjectContext
///
- ///EdmGen06 ^
- /// /ModelGen ^
- /// "Data Source=xxxxx;Initial Catalog=xxxxx;Persist Security Info=True;User ID=xxxxx;Password=xxxxx;MultipleActiveResultSets=true;" ^
- /// "System.Data [残りの文字列は切り詰められました]"; に類似しているローカライズされた文字列を検索します。
+ ///rem [SqlServer Example [残りの文字列は切り詰められました]"; に類似しているローカライズされた文字列を検索します。
///
internal static string Usage {
get {
diff --git a/Properties/Resources.resx b/Properties/Resources.resx
index 2ef2486..498eac0 100644
--- a/Properties/Resources.resx
+++ b/Properties/Resources.resx
@@ -124,6 +124,15 @@
..\conceptualschemadefinitionversion3.csdl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ ..\DbContext_EFv5.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
+
+
+ ..\DbContext_EFv6.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
+
+
+ ..\ObjectContext.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
+
..\usage.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8