├── .gitattributes ├── .gitignore ├── Build ├── GlobalAssemblyInfo.cs └── Key.snk ├── JetDdexProvider ├── Install.cmd ├── Install.vbs ├── JetDdexProvider.csproj ├── JetDdexProvider.reg ├── JetObjectIdentifierResolver.cs ├── JetObjectSelector.cs ├── JetObjectSupport.xml ├── JetObjectTypes.cs ├── JetSourceInformation.cs ├── JetViewSupport.xml └── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── JetEntityFrameworkProvider.Test.DbFirst ├── App.config ├── Form1.Designer.cs ├── Form1.cs ├── JetEntityFrameworkProvider.Test.DbFirst.csproj ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings └── packages.config ├── JetEntityFrameworkProvider.Test ├── App.config ├── BooleanMaterializationTest1.cs ├── BooleanMaterializationTest2.cs ├── BuiltInFunctionsTest.cs ├── CanonicalFunctionsTest1.cs ├── CanonicalFunctionsTest2.cs ├── DataTypesTest.cs ├── DdlTest.cs ├── DmlTest.cs ├── Empty.accdb ├── Empty.mdb ├── FunctionTest.cs ├── Helpers.cs ├── JetEntityFrameworkProvider.Test.VisualState.xml ├── JetEntityFrameworkProvider.Test.csproj ├── JetEntityFrameworkProvider.Test.csproj.DotSettings ├── JetProviderFactory │ └── JetStoreSchemaDefinitionRetrieveTest.cs ├── MigrationUpDownTest │ ├── MigrationExtensions.cs │ ├── MigrationMakeNullable.cs │ ├── MigrationOnDeleteStar.cs │ ├── MigrationUpDownTest.cs │ ├── MigrationWithDefaultValue.cs │ ├── MigrationWithDefaultValueSql.cs │ ├── MigrationWithNumericDefaultValue.cs │ ├── MigrationWithNumericDefaultValueSql.cs │ └── SimpleMigration.cs ├── Model01 │ ├── Context.cs │ ├── Standard.cs │ └── Student.cs ├── Model02 │ ├── Context.cs │ └── TableWithSeveralFieldsType.cs ├── Model04 │ ├── Car.cs │ ├── CarsContext.cs │ ├── JetTest.cs │ ├── Person.cs │ ├── Seed.cs │ └── Test.cs ├── Model04_Guid │ ├── Car.cs │ ├── CarsContext.cs │ ├── JetTest.cs │ ├── Person.cs │ └── Test.cs ├── Model05_WithIndex │ ├── Bar.cs │ ├── Context.cs │ ├── Foo.cs │ ├── JetTest.cs │ └── Test.cs ├── Model06_Inherit │ ├── Address.cs │ ├── BaseEntity.cs │ ├── Context.cs │ ├── JetTest.cs │ ├── Test.cs │ └── User.cs ├── Model07 │ ├── Context.cs │ ├── Entities.cs │ ├── JetTest.cs │ └── Test.cs ├── Model08 │ ├── Context.cs │ ├── File.cs │ ├── FileMap.cs │ ├── GalleryImage.cs │ ├── GalleryImageMap.cs │ ├── JetTest.cs │ ├── PageImage.cs │ ├── PageImageMap.cs │ └── Test.cs ├── Model09 │ ├── Context.cs │ ├── JetTest.cs │ ├── One.cs │ ├── OneMap.cs │ ├── Test.cs │ ├── Three.cs │ ├── ThreeMap.cs │ ├── Two.cs │ └── TwoMap.cs ├── Model10 │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model11 │ ├── Context.cs │ ├── JetTest.cs │ ├── Mappings.cs │ ├── Model.cs │ ├── SqlCeTest.cs │ └── Test.cs ├── Model12_ComplexType │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model13_TableSplit_1_1rel │ ├── JetTest.cs │ ├── Model.cs │ ├── Test.cs │ └── TestContext.cs ├── Model14_StackOverflow31992383 │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model15_SortInheritedColumns │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model16_OwnCollection │ ├── Blog.cs │ ├── BloggingContext.cs │ ├── JetTest.cs │ ├── Post.cs │ ├── PostCollection.cs │ └── Test.cs ├── Model18_CompositeKeys │ ├── JetTest.cs │ ├── Model.cs │ ├── Test.cs │ └── TestContext.cs ├── Model19_1_1 │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model20_HiddenBackingField │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model21_CommandInterception │ ├── Car.cs │ ├── CarsContext.cs │ ├── DbCommandInterceptor.cs │ ├── DbCommandTreeInterceptor.cs │ ├── JetTest.cs │ └── Test.cs ├── Model23_NestedInclude │ ├── Context.cs │ ├── Document.cs │ ├── DocumentMetadata.cs │ ├── DocumentMetadataExpression.cs │ ├── Expression.cs │ ├── JetTest.cs │ ├── Test.cs │ └── VariableMetadata.cs ├── Model24_MultiTenantApp │ ├── Context.cs │ ├── JetTest.cs │ ├── MyEntity.cs │ ├── Readme.txt │ ├── TenantCommandTreeInterceptor.cs │ └── Test.cs ├── Model25_InheritTPH │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model25_InheritTPT │ ├── Context.cs │ ├── JetTest.cs │ ├── Mapping.cs │ ├── Model.cs │ └── Test.cs ├── Model26_Decompile │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model27_SimpleTest │ ├── JetTest.cs │ ├── MyDbContext.cs │ ├── Test.cs │ ├── User.cs │ └── Vehicle.cs ├── Model28 │ ├── Context.cs │ ├── Helpers.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model30 │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model31_DoubleReference │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model32_Include_NotInclude │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model33_OneToOneDeleteCascade │ ├── Address.cs │ ├── Context.cs │ ├── JetTest.cs │ ├── Person.cs │ └── Test.cs ├── Model34_JetEfBug │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model35_OneToZeroOneDeleteCascade │ ├── Context.cs │ ├── JetTest.cs │ ├── Mappings.cs │ ├── Model.cs │ └── Test.cs ├── Model36_DetachedScenario │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ ├── Repository.cs │ └── Test.cs ├── Model37_2Contexts │ ├── Context1.cs │ ├── Context2.cs │ ├── JetTest.cs │ ├── Model1.cs │ ├── Model2.cs │ └── Test.cs ├── Model38_OneEntity2Tables │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model39_DetachedEntities │ ├── JetTest.cs │ ├── Model.cs │ ├── MyContext.cs │ └── Test.cs ├── Model40_HardMapping │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model41 │ ├── Check.cs │ ├── JetTest.cs │ └── Test.cs ├── Model42 │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model43_PKasFK │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ ├── ParentsHelper.cs │ └── Test.cs ├── Model44_CaseSensitivity │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ ├── SqlCeTest.cs │ └── Test.cs ├── Model45_InheritTPHWithSameRelationship │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model46_InnerClasses │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model47_200 │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ ├── MyContext.cs │ └── Test.cs ├── Model48_Cast │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model49_Inheritance_EagerlyLoad │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model50_Interception │ ├── CommandInterceptor.cs │ ├── Context.cs │ ├── JetTest.cs │ ├── LanguageExtensions.cs │ ├── Model.cs │ └── Test.cs ├── Model51_1_Many_RemoveChildren │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model52_Requires_HasFalse_LogicalDelete │ ├── Context.cs │ ├── JoinErrorTest1.cs │ ├── PanelLookup.cs │ ├── PanelTexture.cs │ └── Texture.cs ├── Model53_TableSplitting │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ ├── Test.cs │ └── readme.txt ├── Model54_MemoryLeakageTest │ ├── Context.cs │ ├── JetTest.cs │ ├── Standard.cs │ ├── Student.cs │ └── Test.cs ├── Model55_Unicode │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model56_SkipTake │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ ├── SqlCeTest.cs │ └── Test.cs ├── Model57_StackOverflow │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model58_TruncateTime │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model59_StackOverflow_TPT_TPH │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model60_StackOverflow_m2n_Person_Book │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model61_StackOverflow_Seed │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model62_InnerQueryBug_DbInitializerSeed │ ├── Context.cs │ ├── DbInitializer.cs │ ├── JetTest.cs │ ├── Model.cs │ ├── SqlCeTest.cs │ ├── SqlServerTest.cs │ └── Test.cs ├── Model63_Time │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model64_Schema │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model65_InMemoryObjects │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model66_StackOverflow_TooManyColumns │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model67_DifferentProxies │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model68_sbyte │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ ├── SqlCeTest.cs │ ├── SqlServerTest.cs │ └── Test.cs ├── Model69_PrivateBackingField │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model70_InMemoryObjectPartialUpdate │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model71_MasterDetail │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model72_ComplexTypeWNavyProp │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model73_Guid_issue20 │ ├── Car.cs │ ├── CarsContext.cs │ ├── JetTest.cs │ └── Test.cs ├── Model74_Decimal_issue27 │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model75_Include_issue28 │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model76_Contains │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model77_RepoModel │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ ├── Repository.cs │ ├── RepositoryModel.cs │ └── Test.cs ├── Model78_SimpleSample │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Model79_Like │ ├── Context.cs │ ├── JetTest.cs │ ├── Model.cs │ └── Test.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── SetUpCodeFirst.cs ├── SqlJoinTest.cs └── packages.config ├── JetEntityFrameworkProvider.Utilities ├── App.config ├── FunctionStubFileWriter.cs ├── JetEntityFrameworkProvider.Utilities.csproj ├── LinqFunctionStubsCodeGen.cs ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Resources │ └── SchemaDefinitionSqlServerQueries.xml ├── SchemaDefinitionSqlServerQueriesModel.cs ├── SchemaDefinitionTablesSerializer.cs ├── XmlObjectSerializer.cs └── packages.config ├── JetEntityFrameworkProvider.sln ├── JetEntityFrameworkProvider.sln.DotSettings ├── JetEntityFrameworkProvider ├── App.config ├── Documentation │ ├── CanonicalFunctions.txt │ ├── DbFirstImplementation.txt │ ├── JetSQL.txt │ └── JetSQLFunctions.txt ├── GeneratorDdl │ ├── JetCreateDatabaseSqlGenerator.cs │ ├── JetDdlBuilder.cs │ └── JetMigrationSqlGenerator.cs ├── GeneratorDml │ └── JetDmlBuilder.cs ├── GeneratorSql │ ├── ISqlFragment.cs │ ├── IllegalDbExpressionException.cs │ ├── JoinSymbol.cs │ ├── MetadataHelpers.cs │ ├── SkipClause.cs │ ├── SqlBuilder.cs │ ├── SqlGenerator.cs │ ├── SqlSelectStatement.cs │ ├── SqlWriter.cs │ ├── Symbol.cs │ ├── SymbolPair.cs │ ├── SymbolTable.cs │ └── TopClause.cs ├── JetCommand.cs ├── JetConnection.cs ├── JetConnectionFactory.cs ├── JetDataReader.cs ├── JetDataTypeAlias.cs ├── JetDataTypeAliasCollection.cs ├── JetEntityFrameworkProvider.csproj ├── JetEntityFrameworkProvider.csproj.DotSettings ├── JetFunctions.cs ├── JetProviderFactory.cs ├── JetProviderManifest.cs ├── JetProviderServices.cs ├── JetStoreSchemaDefinition │ ├── Column.cs │ ├── ColumnCollection.cs │ ├── JetStoreSchemaDefinitionRetrieve.cs │ ├── SystemTable.cs │ └── SystemTableCollection.cs ├── JetTableExistenceChecker.cs ├── JetTransaction.cs ├── LiteralHelpers.cs ├── OleDbColumnFlagEnum.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Resources │ ├── JetProviderServices.ProviderManifest.xml │ ├── JetProviderServices.StoreSchemaDefinition.ssdl │ ├── JetProviderServices.StoreSchemaMapping.msl │ ├── StoreSchemaDefinition.CheckConstraints.xml │ ├── StoreSchemaDefinition.ConstraintColumns.xml │ ├── StoreSchemaDefinition.Constraints.xml │ ├── StoreSchemaDefinition.ForeignKeyConstraints.xml │ ├── StoreSchemaDefinition.ForeignKeys.xml │ ├── StoreSchemaDefinition.FunctionParameters.xml │ ├── StoreSchemaDefinition.FunctionReturnTableColumns.xml │ ├── StoreSchemaDefinition.Functions.xml │ ├── StoreSchemaDefinition.IndexColumns.xml │ ├── StoreSchemaDefinition.Indexes.xml │ ├── StoreSchemaDefinition.ProcedureParameters.xml │ ├── StoreSchemaDefinition.Procedures.xml │ ├── StoreSchemaDefinition.TableColumns.xml │ ├── StoreSchemaDefinition.Tables.xml │ ├── StoreSchemaDefinition.ViewColumns.xml │ ├── StoreSchemaDefinition.ViewConstraintColumns.xml │ ├── StoreSchemaDefinition.ViewConstraints.xml │ ├── StoreSchemaDefinition.ViewForeignKeys.xml │ ├── StoreSchemaDefinition.Views.xml │ ├── StoreSchemaDefinitionRetrieve_QueryHack1.txt │ └── StoreSchemaDefinitionRetrieve_QueryHack2.txt ├── SetupInfo.cs ├── StringHelpers.cs ├── TypeUsageHelper.cs ├── XmlObjectSerializer.cs └── packages.config ├── NuGet.Packager ├── App.config.install.xdt ├── App.config.uninstall.xdt ├── Compile.config.txt ├── Compile.exe ├── JetEntityFrameworkProvider.nuspec ├── NuGet.exe ├── _MakeSetup.bat ├── _MakeSetup_Pack.bat ├── _MakeSetup_Push.bat └── _MakeSetup_msbuild.bat └── docs ├── Enabling_CodeFirst_simple_migration.md ├── Enabling_db_first.md ├── README.md ├── license.md └── mdb_or_accdb_setup.md /Build/GlobalAssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bubibubi/JetEntityFrameworkProvider/ea5edff891d2bf716d248018b669e2c588245267/Build/GlobalAssemblyInfo.cs -------------------------------------------------------------------------------- /Build/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bubibubi/JetEntityFrameworkProvider/ea5edff891d2bf716d248018b669e2c588245267/Build/Key.snk -------------------------------------------------------------------------------- /JetDdexProvider/JetObjectTypes.cs: -------------------------------------------------------------------------------- 1 | namespace JetDdexProvider 2 | { 3 | /// 4 | /// Represents constant string values for all the supported data object 5 | /// types. This list must be in sync with the data object support XML. 6 | /// 7 | static class JetObjectTypes 8 | { 9 | public const string Root = ""; 10 | public const string Table = "Table"; 11 | public const string Column = "Column"; 12 | public const string Index = "Index"; 13 | public const string IndexColumn = "IndexColumn"; 14 | public const string ForeignKey = "ForeignKey"; 15 | public const string ForeignKeyColumn = "ForeignKeyColumn"; 16 | public const string View = "View"; 17 | public const string ViewColumn = "ViewColumn"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /JetDdexProvider/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("JetDDEXProvider")] 4 | [assembly: AssemblyDescription("Jet Extended Provider")] 5 | 6 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test.DbFirst/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace JetEntityFrameworkProvider.Test.DbFirst 12 | { 13 | public partial class Form1 : Form 14 | { 15 | public Form1() 16 | { 17 | InitializeComponent(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test.DbFirst/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace JetEntityFrameworkProvider.Test.DbFirst 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test.DbFirst/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test.DbFirst/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/BooleanMaterializationTest1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using JetEntityFrameworkProvider.Test.Model01; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test 7 | { 8 | [TestClass] 9 | public class BooleanMaterializationTest1 10 | { 11 | [TestMethod] 12 | public void Run() 13 | { 14 | using (var context = new Context(SetUpCodeFirst.Connection)) 15 | { 16 | // ReSharper disable once RedundantCast 17 | Console.WriteLine(context.Students.Select(c => new {MyNewProperty = (bool) true}).ToList().Count); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/BooleanMaterializationTest2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using JetEntityFrameworkProvider.Test.Model02; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test 7 | { 8 | [TestClass] 9 | public class BooleanMaterializationTest2 10 | { 11 | [TestMethod] 12 | public void Run() 13 | { 14 | using (var context = new Context(SetUpCodeFirst.Connection)) 15 | { 16 | // ReSharper disable once RedundantCast 17 | Console.WriteLine(context.TableWithSeveralFieldsTypes.Select(c => new {MyNewProperty = (bool) true}).ToList().Count); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/DdlTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | 4 | namespace JetEntityFrameworkProvider.Test 5 | { 6 | [TestClass] 7 | public class DdlTest 8 | { 9 | [TestMethod] 10 | public void CheckIfTablesExists() 11 | { 12 | bool exists = ((JetConnection)SetUpCodeFirst.Connection).TableExists("Students"); 13 | Assert.IsTrue(exists); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Empty.accdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bubibubi/JetEntityFrameworkProvider/ea5edff891d2bf716d248018b669e2c588245267/JetEntityFrameworkProvider.Test/Empty.accdb -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Empty.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bubibubi/JetEntityFrameworkProvider/ea5edff891d2bf716d248018b669e2c588245267/JetEntityFrameworkProvider.Test/Empty.mdb -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/JetEntityFrameworkProvider.Test.csproj.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | No -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/MigrationUpDownTest/MigrationWithDefaultValue.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity.Migrations; 2 | 3 | namespace JetEntityFrameworkProvider.Test.MigrationUpDownTest 4 | { 5 | public class MigrationWithDefaultValue : DbMigration 6 | { 7 | public override void Up() 8 | { 9 | CreateTable( 10 | "MigrationWithDefaultValue", 11 | c => new 12 | { 13 | Id = c.Int(nullable: false, identity: true), 14 | Description = c.String(false, 50, null, null, "DftValue") 15 | }) 16 | .PrimaryKey(t => t.Id); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/MigrationUpDownTest/MigrationWithDefaultValueSql.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity.Migrations; 2 | 3 | namespace JetEntityFrameworkProvider.Test.MigrationUpDownTest 4 | { 5 | public class MigrationWithDefaultValueSql : DbMigration 6 | { 7 | public override void Up() 8 | { 9 | CreateTable( 10 | "MigrationWithDefaultValueSql", 11 | c => new 12 | { 13 | Id = c.Int(nullable: false, identity: true), 14 | Description = c.String(true, 50, null, null, null, "DftValue"), 15 | DescriptionNotNullable = c.String(false, 50, null, null, null, "DftValue") 16 | }) 17 | .PrimaryKey(t => t.Id); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/MigrationUpDownTest/MigrationWithNumericDefaultValue.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity.Migrations; 2 | 3 | namespace JetEntityFrameworkProvider.Test.MigrationUpDownTest 4 | { 5 | public class MigrationWithNumericDefaultValue : DbMigration 6 | { 7 | public override void Up() 8 | { 9 | CreateTable( 10 | "MigrationWithNumericDefaultValue", 11 | c => new 12 | { 13 | Id = c.Int(nullable: false, identity: true), 14 | Description = c.String(false, 50), 15 | Age = c.Int(nullable: false, defaultValue:50), 16 | AgeNotNullable = c.Int(nullable: true, defaultValue: 50) 17 | }) 18 | .PrimaryKey(t => t.Id); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/MigrationUpDownTest/MigrationWithNumericDefaultValueSql.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity.Migrations; 2 | 3 | namespace JetEntityFrameworkProvider.Test.MigrationUpDownTest 4 | { 5 | public class MigrationWithNumericDefaultValueSql : DbMigration 6 | { 7 | public override void Up() 8 | { 9 | CreateTable( 10 | "MigrationWithNumericDftValueSql", 11 | c => new 12 | { 13 | Id = c.Int(nullable: false, identity: true), 14 | Description = c.String(false, 50), 15 | Age = c.Int(nullable: false, defaultValueSql: "50"), 16 | AgeNotNullable = c.Int(nullable: true, defaultValueSql: "50") 17 | }) 18 | .PrimaryKey(t => t.Id); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/MigrationUpDownTest/SimpleMigration.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity.Migrations; 2 | 3 | namespace JetEntityFrameworkProvider.Test.MigrationUpDownTest 4 | { 5 | public class SimpleMigration : DbMigration 6 | { 7 | public override void Up() 8 | { 9 | CreateTable( 10 | "SimpleMigrationTest", 11 | c => new 12 | { 13 | Id = c.Int(nullable: false, identity: true), 14 | Description = c.String(false, 50) 15 | }) 16 | .PrimaryKey(t => t.Id); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model01/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model01 6 | { 7 | public class Context : System.Data.Entity.DbContext 8 | { 9 | // For migration test 10 | public Context() 11 | { } 12 | 13 | 14 | public Context(DbConnection connection) 15 | : base(connection, false) 16 | {} 17 | public DbSet Students { get; set; } 18 | public DbSet Standards { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model01/Standard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model01 6 | { 7 | public class Standard 8 | { 9 | public Standard() 10 | { 11 | Students = new List(); 12 | } 13 | 14 | [Index("MultipleColumnIndex", 2)] 15 | public int StandardId { get; set; } 16 | [Index("MultipleColumnIndex", 1)] 17 | public string StandardName { get; set; } 18 | public string Description { get; set; } 19 | 20 | public virtual ICollection Students { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model01/Student.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model01 6 | { 7 | public class Student 8 | { 9 | public int StudentId { get; set; } 10 | 11 | [Required] 12 | [MaxLength(50)] 13 | [Index] 14 | public string StudentName { get; set; } 15 | 16 | public string Notes { get; set; } 17 | 18 | public virtual Standard Standard { get; set; } 19 | 20 | public override string ToString() 21 | { 22 | return string.Format("{2}: {0} - {1}", StudentId, StudentName, base.ToString()); 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model02/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model02 6 | { 7 | public class Context : System.Data.Entity.DbContext 8 | { 9 | // For migration test 10 | public Context() 11 | { } 12 | 13 | 14 | public Context(DbConnection connection) 15 | : base(connection, false) 16 | {} 17 | 18 | public DbSet TableWithSeveralFieldsTypes { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model02/TableWithSeveralFieldsType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model02 5 | { 6 | public class TableWithSeveralFieldsType 7 | { 8 | [Key] 9 | public int Id { get; set; } 10 | public int MyInt { get; set; } 11 | public double MyDouble { get; set; } 12 | public string MyString { get; set; } 13 | public DateTime MyDateTime { get; set; } 14 | public bool MyBool { get; set; } 15 | public bool MyNullableBool { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model04/Car.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model04 4 | { 5 | public class Car 6 | { 7 | public int Id { get; set; } 8 | public string Name { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model04/CarsContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model04 6 | { 7 | public class CarsContext : DbContext 8 | { 9 | public CarsContext(DbConnection connection) 10 | : base(connection, false) 11 | {} 12 | 13 | // For migration test 14 | public CarsContext() 15 | { } 16 | 17 | public DbSet Cars { get; set; } 18 | public DbSet Persons { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model04/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model04 6 | { 7 | [TestClass] 8 | public class Model04JetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model04/Person.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model04 4 | { 5 | public class Person 6 | { 7 | public int Id { get; set; } 8 | public string Name { get; set; } 9 | public virtual Car OwnedCar { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model04/Seed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model04 5 | { 6 | public static class Seed 7 | { 8 | public static void SeedPersons(CarsContext context) 9 | { 10 | 11 | if (context.Persons.Count() != 0) 12 | return; 13 | 14 | for (int i = 0; i < 10; i++) 15 | { 16 | context.Persons.Add(new Person() 17 | { 18 | Name = "PersonName " + (10 - i) 19 | } 20 | ); 21 | } 22 | 23 | context.SaveChanges(); 24 | 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model04_Guid/Car.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model04_Guid 5 | { 6 | [Table("CarWGuid")] 7 | public class Car 8 | { 9 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 10 | public Guid Id { get; set; } 11 | public string Name { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model04_Guid/CarsContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model04_Guid 6 | { 7 | public class CarsContext : DbContext 8 | { 9 | public CarsContext(DbConnection connection) 10 | : base(connection, false) 11 | {} 12 | 13 | // For migration test 14 | public CarsContext() 15 | { } 16 | 17 | public DbSet Cars { get; set; } 18 | public DbSet Persons { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model04_Guid/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model04_Guid 6 | { 7 | [TestClass] 8 | public class Model04GuidJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model04_Guid/Person.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model04_Guid 5 | { 6 | [Table("PersonWGuid")] 7 | public class Person 8 | { 9 | [DatabaseGenerated(DatabaseGeneratedOption.None)] 10 | public Guid Id { get; set; } 11 | public string Name { get; set; } 12 | public virtual Car OwnedCar { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model05_WithIndex/Bar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model05_WithIndex 6 | { 7 | public class Bar 8 | { 9 | [Key] 10 | public int barID {get;set;} 11 | 12 | [Index("IX_UniqueWithinFoo", 0, IsUnique = true)] 13 | public int parent_FooId { get; set; } 14 | 15 | [ForeignKey("parent_FooId")] 16 | public virtual Foo parent { get; set; } 17 | 18 | [Index("IX_UniqueWithinFoo", 1, IsUnique = true)] 19 | public int order { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model05_WithIndex/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model05_WithIndex 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context(DbConnection connection) 10 | : base(connection, false) 11 | {} 12 | 13 | public DbSet Foos { get; set; } 14 | public DbSet Bars { get; set; } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model05_WithIndex/Foo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model05_WithIndex 5 | { 6 | public class Foo 7 | { 8 | [Key] 9 | public int FooID {get; set;} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model05_WithIndex/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model05_WithIndex 6 | { 7 | [TestClass] 8 | public class Model05JetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model05_WithIndex/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model05_WithIndex 7 | { 8 | public abstract class Test 9 | { 10 | [TestMethod] 11 | public void Run() 12 | { 13 | using(DbConnection connection = GetConnection()) 14 | using (Context context = new Context(connection)) 15 | { 16 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed 17 | context.Bars.ToList(); 18 | } 19 | } 20 | 21 | protected abstract DbConnection GetConnection(); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model06_Inherit/Address.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model06_Inherit 4 | { 5 | public class Address : BaseEntity 6 | { 7 | //[JsonProperty("street")] 8 | public string Street { get; set; } 9 | 10 | //[JsonProperty("city")] 11 | public string City { get; set; } 12 | 13 | //[JsonProperty("zipcode")] 14 | public string ZipCode { get; set; } 15 | 16 | //[JsonProperty("country")] 17 | public string Country { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model06_Inherit/BaseEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model06_Inherit 4 | { 5 | public class BaseEntity 6 | { 7 | public int Id { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model06_Inherit/Context.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model06_Inherit 5 | { 6 | public class Context : DbContext 7 | { 8 | public Context(DbConnection connection) 9 | : base(connection, false) 10 | { } 11 | 12 | public DbSet
Addresses { get; set; } 13 | public DbSet Users { get; set; } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model06_Inherit/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model06_Inherit 6 | { 7 | [TestClass] 8 | public class Model06_InheritJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model06_Inherit/User.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model06_Inherit 4 | { 5 | public class User : BaseEntity 6 | { 7 | 8 | public string Username { get; set; } 9 | public string Passwd { get; set; } 10 | public string Firstname { get; set; } 11 | public string Middlename { get; set; } 12 | public string Secondname { get; set; } 13 | public DateTime BirthDate { get; set; } 14 | public string Email { get; set; } 15 | public string Mobilenumber { get; set; } 16 | public bool IsActivated { get; set; } 17 | public string ActivationCode { get; set; } 18 | public DateTime? CurrentCreateSession { get; set; } 19 | public DateTime? PreviousCreateSession { get; set; } 20 | public virtual Address Address { get; set; } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model07/Context.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model07 5 | { 6 | public class Context : DbContext 7 | { 8 | public Context(DbConnection connection) 9 | : base(connection, false) 10 | { } 11 | 12 | public DbSet As { get; set; } 13 | public DbSet Bs { get; set; } 14 | public DbSet Cs { get; set; } 15 | public DbSet Acs { get; set; } 16 | 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model07/Entities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.ObjectModel; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model07 5 | { 6 | public class EntityA 7 | { 8 | public int Id { get; set; } 9 | public Collection EntityBCollection { get; set; } 10 | } 11 | 12 | public class EntityA_Child 13 | { 14 | public int Id { get; set; } 15 | 16 | public EntityA EntityA { get; set; } 17 | 18 | public EntityC EntityC { get; set; } 19 | } 20 | 21 | public class EntityB 22 | { 23 | public int Id { get; set; } 24 | public Collection EntityCCollection { get; set; } 25 | } 26 | 27 | public class EntityC 28 | { 29 | public int Id { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model07/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model07 6 | { 7 | [TestClass] 8 | public class Model07 : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model07/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model07 6 | { 7 | public abstract class Test 8 | { 9 | [TestMethod] 10 | public void Run() 11 | { 12 | using (DbConnection connection = GetConnection()) 13 | using (Context context = new Context(connection)) 14 | { 15 | 16 | context.As.Add(new EntityA()); 17 | context.SaveChanges(); 18 | } 19 | } 20 | 21 | protected abstract DbConnection GetConnection(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model08/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model08 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context(DbConnection connection) 10 | : base(connection, false) 11 | { } 12 | 13 | public DbSet Files { get; set; } 14 | public DbSet GalleryImages { get; set; } 15 | public DbSet PageImages { get; set; } 16 | 17 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 18 | { 19 | base.OnModelCreating(modelBuilder); 20 | 21 | modelBuilder.Configurations.Add(new FileMap()); 22 | modelBuilder.Configurations.Add(new GalleryImageMap()); 23 | modelBuilder.Configurations.Add(new PageImageMap()); 24 | } 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model08/File.cs: -------------------------------------------------------------------------------- 1 | namespace JetEntityFrameworkProvider.Test.Model08 2 | { 3 | public partial class File 4 | { 5 | public int Id { get; private set; } // PK 6 | // Other properties 7 | public string Description { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model08/FileMap.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | using System.Data.Entity.ModelConfiguration; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model08 5 | { 6 | public class FileMap : EntityTypeConfiguration 7 | { 8 | public FileMap() 9 | { 10 | // Primary Key 11 | this.HasKey(t => t.Id); 12 | this.Property(t => t.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity); 13 | this.ToTable("Files"); 14 | this.Property(t => t.Id).HasColumnName("Id"); 15 | // Other Properties go here 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model08/GalleryImage.cs: -------------------------------------------------------------------------------- 1 | namespace JetEntityFrameworkProvider.Test.Model08 2 | { 3 | public partial class GalleryImage : File 4 | { 5 | public string A { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model08/GalleryImageMap.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity.ModelConfiguration; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model08 4 | { 5 | public class GalleryImageMap : EntityTypeConfiguration 6 | { 7 | public GalleryImageMap() 8 | { 9 | // Primary Key 10 | this.HasKey(t => t.Id); 11 | this.ToTable("GalleryImages"); 12 | this.Property(t => t.Id).HasColumnName("Id"); 13 | // Other properties go here 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model08/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model08 6 | { 7 | [TestClass] 8 | public class Model08 : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model08/PageImage.cs: -------------------------------------------------------------------------------- 1 | namespace JetEntityFrameworkProvider.Test.Model08 2 | { 3 | public partial class PageImage : File 4 | { 5 | public string B { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model08/PageImageMap.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity.ModelConfiguration; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model08 4 | { 5 | public class PageImageMap : EntityTypeConfiguration 6 | { 7 | public PageImageMap() 8 | { 9 | // Primary Key 10 | this.HasKey(t => t.Id); 11 | 12 | // Table & Column Mappings 13 | this.ToTable("PageImages"); 14 | this.Property(t => t.Id).HasColumnName("Id"); 15 | // Other properties go here 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model08/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model08 6 | { 7 | public abstract class Test 8 | { 9 | [TestMethod] 10 | public void Run() 11 | { 12 | using (DbConnection connection = GetConnection()) 13 | using (Context context = new Context(connection)) 14 | { 15 | context.Files.Add(new File() { }); 16 | context.SaveChanges(); 17 | } 18 | } 19 | 20 | protected abstract DbConnection GetConnection(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model09/Context.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model09 5 | { 6 | public class Context : DbContext 7 | { 8 | public Context(DbConnection connection) 9 | : base(connection, false) 10 | { } 11 | 12 | public DbSet Ones { get; set; } 13 | public DbSet Twos { get; set; } 14 | public DbSet Threes { get; set; } 15 | 16 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 17 | { 18 | base.OnModelCreating(modelBuilder); 19 | 20 | modelBuilder.Configurations.Add(new OneMap()); 21 | modelBuilder.Configurations.Add(new TwoMap()); 22 | modelBuilder.Configurations.Add(new ThreeMap()); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model09/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model09 6 | { 7 | [TestClass] 8 | public class Model09 : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model09/One.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model09 4 | { 5 | public class One 6 | { 7 | public int Id { get; set; } 8 | public ICollection TwoList { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model09/OneMap.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity.ModelConfiguration; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model09 4 | { 5 | public class OneMap : EntityTypeConfiguration 6 | { 7 | public OneMap() 8 | { 9 | this.HasKey(t => t.Id); 10 | ToTable("One"); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model09/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model09 6 | { 7 | public abstract class Test 8 | { 9 | [TestMethod] 10 | public void Run() 11 | { 12 | using (DbConnection connection = GetConnection()) 13 | using (Context context = new Context(connection)) 14 | { 15 | context.Ones.Add(new One() { }); 16 | context.SaveChanges(); 17 | } 18 | } 19 | 20 | protected abstract DbConnection GetConnection(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model09/Three.cs: -------------------------------------------------------------------------------- 1 | namespace JetEntityFrameworkProvider.Test.Model09 2 | { 3 | public class Three 4 | { 5 | public int Id { get; set; } 6 | public int TwoId { get; set; } 7 | public int OneId { get; set; } 8 | public virtual Two Two { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model09/ThreeMap.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity.ModelConfiguration; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model09 4 | { 5 | public class ThreeMap : EntityTypeConfiguration 6 | { 7 | public ThreeMap() 8 | { 9 | HasKey(t => new { t.Id, t.OneId, t.TwoId }); 10 | ToTable("Three"); 11 | 12 | HasRequired(t => t.Two).WithMany(t => t.ThreeList).HasForeignKey(t => new {t.OneId, t.TwoId}); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model09/Two.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model09 4 | { 5 | public class Two 6 | { 7 | public int Id { get; set; } 8 | public int OneId { get; set; } 9 | public virtual One One { get; set; } 10 | public virtual ICollection ThreeList { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model09/TwoMap.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity.ModelConfiguration; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model09 4 | { 5 | public class TwoMap : EntityTypeConfiguration 6 | { 7 | public TwoMap() 8 | { 9 | this.HasKey(t => new { t.Id, t.OneId }); 10 | ToTable("Two"); 11 | 12 | HasRequired(t => t.One).WithMany(t => t.TwoList).HasForeignKey(t => t.OneId); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model10/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | using System.Data.Entity.ModelConfiguration.Conventions; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model10 7 | { 8 | public class TestContext : DbContext 9 | { 10 | public TestContext(DbConnection connection) : base(connection, true){} 11 | 12 | public DbSet SomeClasses { get; set; } 13 | public DbSet Behaviors { get; set; } 14 | 15 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 16 | { 17 | base.OnModelCreating(modelBuilder); 18 | 19 | modelBuilder.Conventions.Remove(); 20 | 21 | modelBuilder.Entity() 22 | .HasOptional(s => s.Behavior) 23 | .WithRequired() 24 | .WillCascadeOnDelete(true); 25 | 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model10/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model10 6 | { 7 | [TestClass] 8 | public class Model10 : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model10/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model10 4 | { 5 | public class SomeClass 6 | { 7 | public int SomeClassId { get; set; } 8 | public string Name { get; set; } 9 | public virtual Behavior Behavior { get; set; } 10 | } 11 | 12 | public abstract class Behavior 13 | { 14 | public int BehaviorId { get; set; } 15 | } 16 | 17 | public class BehaviorA : Behavior 18 | { 19 | public string BehaviorASpecific { get; set; } 20 | } 21 | 22 | public class BehaviorB : Behavior 23 | { 24 | public string BehaviorBSpecific { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model11/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model11 6 | { 7 | public class TestContext : DbContext 8 | { 9 | public TestContext(DbConnection connection) : base(connection, true) { } 10 | 11 | public DbSet InternCodes { get; set; } 12 | public DbSet Models { get; set; } 13 | public DbSet Versions { get; set; } 14 | 15 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 16 | { 17 | modelBuilder.Configurations.Add(new VersionMap()); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model11/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model11 6 | { 7 | #warning This test does not work with access because access does not support longs 8 | //[TestClass] 9 | public class Model11JetTest : Test 10 | { 11 | protected override DbConnection GetConnection() 12 | { 13 | return Helpers.GetJetConnection(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model11/Mappings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Entity.ModelConfiguration; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model11 5 | { 6 | public class VersionMap : EntityTypeConfiguration 7 | { 8 | public VersionMap() 9 | { 10 | // Relationships 11 | HasMany(t => t.Models) 12 | .WithMany(t => t.Versions); 13 | 14 | HasMany(t => t.DataReleaseLevels) 15 | .WithMany(t => t.Versions); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model11/SqlCeTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model11 6 | { 7 | [TestClass] 8 | public class Model11CeTest : Test 9 | { 10 | 11 | protected override DbConnection GetConnection() 12 | { 13 | return Helpers.GetSqlCeConnection(); 14 | } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model12_ComplexType/Context.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model12_ComplexType 5 | { 6 | public class TestContext : DbContext 7 | { 8 | public TestContext(DbConnection connection) : base(connection, true) { } 9 | 10 | public DbSet Friends { get; set; } 11 | public DbSet LessThanFriends { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model12_ComplexType/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model12_ComplexType 6 | { 7 | [TestClass] 8 | public class Model12ComplexType : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model12_ComplexType/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model12_ComplexType 6 | { 7 | public abstract class Test 8 | { 9 | [TestMethod] 10 | public void Run() 11 | { 12 | using (DbConnection connection = GetConnection()) 13 | using (TestContext db = new TestContext(connection)) 14 | { 15 | var friend = new Friend 16 | { 17 | Name = "Bubi", 18 | Address = 19 | { 20 | Cap = "40100", 21 | Street = "The street" 22 | } 23 | }; 24 | 25 | db.Friends.Add(friend); 26 | 27 | db.SaveChanges(); 28 | } 29 | } 30 | 31 | protected abstract DbConnection GetConnection(); 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model13_TableSplit_1_1rel/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model13_TableSplit_1_1rel 6 | { 7 | [TestClass] 8 | public class Model13_TableSplit_1_1relJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model13_TableSplit_1_1rel/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model13_TableSplit_1_1rel 6 | { 7 | [Table("Addresses13")] 8 | public class Address 9 | { 10 | [Key] 11 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 12 | public int Id { get; set; } 13 | 14 | public string Description { get; set; } 15 | 16 | public virtual Visit Visit { get; set; } 17 | } 18 | 19 | [Table("Visits13")] 20 | public class Visit 21 | { 22 | public Visit() 23 | { 24 | Address = new Address(); 25 | } 26 | 27 | [Key] 28 | [ForeignKey("Address")] 29 | public int Id { get; set; } 30 | 31 | public string Description { get; set; } 32 | 33 | public virtual Address Address { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model13_TableSplit_1_1rel/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model13_TableSplit_1_1rel 6 | { 7 | public abstract class Test 8 | { 9 | protected abstract DbConnection GetConnection(); 10 | 11 | [TestMethod] 12 | public void Run() 13 | { 14 | using (DbConnection connection = GetConnection()) 15 | using (TestContext db = new TestContext(connection)) 16 | { 17 | var visit = new Visit 18 | { 19 | Description = "Visit", 20 | Address = { Description = "AddressDescription" } 21 | }; 22 | 23 | db.Visits.Add(visit); 24 | 25 | db.SaveChanges(); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model13_TableSplit_1_1rel/TestContext.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model13_TableSplit_1_1rel 5 | { 6 | public class TestContext : DbContext 7 | { 8 | public TestContext(DbConnection connection) : base(connection, true) { } 9 | 10 | public DbSet
Adresses { get; set; } 11 | public DbSet Visits { get; set; } 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model14_StackOverflow31992383/Context.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model14_StackOverflow31992383 5 | { 6 | public class TestContext : DbContext 7 | { 8 | public TestContext(DbConnection connection) : base(connection, true) { } 9 | 10 | public DbSet C1s { get; set; } 11 | public DbSet C3s { get; set; } 12 | 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model14_StackOverflow31992383/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model14_StackOverflow31992383 6 | { 7 | [TestClass] 8 | public class Model14_StackOverflow31992383JetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model14_StackOverflow31992383/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model14_StackOverflow31992383 5 | { 6 | public class Class1 7 | { 8 | [Key] 9 | public int Id { get; set; } 10 | 11 | public virtual string MyProperty { get; set; } 12 | // other properties 13 | } 14 | 15 | public class Class3 : Class1 16 | { 17 | [Required] 18 | public override string MyProperty { get; set; } 19 | 20 | public string Class3Prop { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model15_SortInheritedColumns/Context.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model15_SortInheritedColumns 5 | { 6 | public class TestContext : DbContext 7 | { 8 | public TestContext(DbConnection connection) : base(connection, true) { } 9 | 10 | public DbSet Brands { get; set; } 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model15_SortInheritedColumns/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model15_SortInheritedColumns 6 | { 7 | [TestClass] 8 | public class Model15_SortInheritedColumnsJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model15_SortInheritedColumns/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model15_SortInheritedColumns 7 | { 8 | public abstract class Test 9 | { 10 | protected abstract DbConnection GetConnection(); 11 | 12 | [TestMethod] 13 | public void Run() 14 | { 15 | using (DbConnection connection = GetConnection()) 16 | using (TestContext db = new TestContext(connection)) 17 | { 18 | db.Brands.Add(new Brand()); 19 | db.SaveChanges(); // Just to run DB and Table creation statement 20 | 21 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed 22 | db.Brands.Where(b => b.addDate.ToString().Contains("abc")).ToList(); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model16_OwnCollection/Blog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model16_OwnCollection 5 | { 6 | public class Blog 7 | { 8 | public Blog() 9 | { 10 | Posts = new PostCollection(); 11 | } 12 | 13 | public int BlogId { get; set; } 14 | [MaxLength(200)] 15 | [ConcurrencyCheck] 16 | public string Name { get; set; } 17 | 18 | public virtual PostCollection Posts { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model16_OwnCollection/BloggingContext.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model16_OwnCollection 5 | { 6 | public class BloggingContext : DbContext 7 | { 8 | public BloggingContext(DbConnection connection) 9 | : base(connection, false) 10 | {} 11 | 12 | // For migration test 13 | public BloggingContext() 14 | { } 15 | 16 | public DbSet Blogs { get; set; } 17 | public DbSet Posts { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model16_OwnCollection/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model16_OwnCollection 6 | { 7 | [TestClass] 8 | public class Model16_OwnCollectionJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model16_OwnCollection/Post.cs: -------------------------------------------------------------------------------- 1 | namespace JetEntityFrameworkProvider.Test.Model16_OwnCollection 2 | { 3 | public class Post 4 | { 5 | public int PostId { get; set; } 6 | public string Title { get; set; } 7 | public string Content { get; set; } 8 | 9 | public int BlogId { get; set; } 10 | public virtual Blog Blog { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model16_OwnCollection/PostCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model16_OwnCollection 4 | { 5 | public class PostCollection : ObservableCollection 6 | { 7 | public Post Add(string title, string content) 8 | { 9 | Post post = new Post 10 | { 11 | Title = title, 12 | Content = content 13 | }; 14 | Add(post); 15 | return post; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model18_CompositeKeys/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model18_CompositeKeys 6 | { 7 | [TestClass] 8 | public class Model18_CompositeKeysJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model18_CompositeKeys/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model18_CompositeKeys 6 | { 7 | public class GoodsIssueProcess 8 | { 9 | 10 | [Key, Column(Order = 1), MaxLength(128)] 11 | public string DeliveryNote { get; set; } 12 | 13 | [Key, Column(Order = 2), ForeignKey("Product")] 14 | public int ProductId { get; set; } 15 | public Product Product { get; set; } 16 | } 17 | 18 | public class Product 19 | { 20 | // the unique ID of the product 21 | [Key] 22 | public int Id { get; set; } 23 | 24 | [Required, MaxLength(36)] 25 | [Index("IX_ArticleNumber", 1, IsUnique = true)] 26 | public string ArticleNumber { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model18_CompositeKeys/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model18_CompositeKeys 6 | { 7 | public abstract class Test 8 | { 9 | protected abstract DbConnection GetConnection(); 10 | 11 | [TestMethod] 12 | public void Run() 13 | { 14 | using (DbConnection connection = GetConnection()) 15 | using (TestContext context = new TestContext(connection)) 16 | { 17 | context.Products.Add( 18 | new Product() 19 | { 20 | ArticleNumber = "ABCD" 21 | }); 22 | context.SaveChanges(); 23 | } 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model18_CompositeKeys/TestContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model18_CompositeKeys 6 | { 7 | public class TestContext : DbContext 8 | { 9 | public TestContext(DbConnection connection) 10 | : base(connection, false) 11 | {} 12 | 13 | public DbSet Products { get; set; } 14 | public DbSet Processes { get; set; } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model19_1_1/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model19_1_1 6 | { 7 | class Context : DbContext 8 | { 9 | public Context(DbConnection connection) 10 | : base(connection, false) 11 | { } 12 | 13 | public DbSet As { get; set; } 14 | public DbSet Bs { get; set; } 15 | 16 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 17 | { 18 | modelBuilder.Entity().HasOptional(c => c.ClassA).WithOptionalDependent(c => c.ClassB); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model19_1_1/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model19_1_1 6 | { 7 | [TestClass] 8 | public class Model19_1_1JetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model19_1_1/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model19_1_1 4 | { 5 | public class ClassA 6 | { 7 | public int Id { get; set; } 8 | public string Description { get; set; } 9 | public virtual ClassB ClassB { get; set; } 10 | } 11 | 12 | public class ClassB 13 | { 14 | public int Id { get; set; } 15 | public string Description { get; set; } 16 | public virtual ClassA ClassA { get; set; } 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model20_HiddenBackingField/Context.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model20_HiddenBackingField 5 | { 6 | class Context : DbContext 7 | { 8 | public Context(DbConnection connection) 9 | : base(connection, false) 10 | { } 11 | 12 | public DbSet Companies { get; set; } 13 | public DbSet Employees { get; set; } 14 | 15 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 16 | { 17 | modelBuilder.Configurations.Add(new Entity.EntityMap()); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model20_HiddenBackingField/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model20_HiddenBackingField 6 | { 7 | [TestClass] 8 | public class Model20_HiddenBackingFieldJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model20_HiddenBackingField/Test.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model20_HiddenBackingField 5 | { 6 | public abstract class Test 7 | { 8 | [TestMethod] 9 | public void Run() 10 | { 11 | using (DbConnection connection = GetConnection()) 12 | using (Context context = new Context(connection)) 13 | { 14 | context.Companies.Add(new Company()); 15 | } 16 | } 17 | 18 | protected abstract DbConnection GetConnection(); 19 | 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model21_CommandInterception/Car.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model21_CommandInterception 5 | { 6 | [Table("Car21")] 7 | public class Car 8 | { 9 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 10 | public int Id { get; set; } 11 | public string Name { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model21_CommandInterception/DbCommandTreeInterceptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Entity.Infrastructure.Interception; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model21_CommandInterception 5 | { 6 | class DbCommandTreeInterceptor : IDbCommandTreeInterceptor 7 | { 8 | public void TreeCreated(DbCommandTreeInterceptionContext interceptionContext) 9 | { 10 | Console.WriteLine(interceptionContext.OriginalResult); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model21_CommandInterception/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model21_CommandInterception 6 | { 7 | [TestClass] 8 | public class Model21_CommandInterceptionJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model21_CommandInterception/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model21_CommandInterception 6 | { 7 | public abstract class Test 8 | { 9 | protected abstract DbConnection GetConnection(); 10 | 11 | [TestMethod] 12 | public void Run() 13 | { 14 | using (DbConnection connection = GetConnection()) 15 | using (CarsContext context = new Model21_CommandInterception.CarsContext(connection)) 16 | { 17 | context.Cars.Add(new Car() { Name = "Ferrari" }); 18 | context.SaveChanges(); 19 | } 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model23_NestedInclude/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model23_NestedInclude 6 | { 7 | class Context : DbContext 8 | { 9 | 10 | public Context(DbConnection connection) 11 | : base(connection, false) 12 | { 13 | } 14 | 15 | // For migration test 16 | public Context() 17 | { } 18 | 19 | public DbSet Documents { get; set; } 20 | public DbSet DocumentMetadatas { get; set; } 21 | public DbSet DocumentMetadataExps { get; set; } 22 | public DbSet VariableMetadatas { get; set; } 23 | public DbSet Expressions { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model23_NestedInclude/Document.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model23_NestedInclude 5 | { 6 | public class Document 7 | { 8 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 9 | public Guid Id { get; set; } 10 | public string Name { get; set; } 11 | public DocumentMetadata DocumentMetadata { get; set; } 12 | 13 | public override string ToString() 14 | { 15 | return string.Format("Document {0} {1}=> {2}", Id, Name, DocumentMetadata); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model23_NestedInclude/DocumentMetadataExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model23_NestedInclude 5 | { 6 | public class DocumentMetadataExpression 7 | { 8 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 9 | public Guid Id { get; set; } 10 | public Expression Expression { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model23_NestedInclude/Expression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model23_NestedInclude 5 | { 6 | 7 | public class Expression 8 | { 9 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 10 | public Guid Id { get; set; } 11 | public string Name { get; set; } 12 | public string Value { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model23_NestedInclude/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model23_NestedInclude 6 | { 7 | [TestClass] 8 | public class Model23_NestedIncludeJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model23_NestedInclude/VariableMetadata.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model23_NestedInclude 5 | { 6 | public class VariableMetadata 7 | { 8 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 9 | public Guid Id { get; set; } 10 | public string Name { get; set; } 11 | public string Type { get; set; } 12 | public string DefaultValue { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model24_MultiTenantApp/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | using System.Data.Entity.Infrastructure.Interception; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model24_MultiTenantApp 7 | { 8 | public class Context : DbContext 9 | { 10 | private readonly IDbInterceptor _dbTreeInterceptor; 11 | 12 | public Context(DbConnection connection) 13 | : base(connection, false) 14 | { 15 | // NOT THE RIGHT PLACE TO DO THIS!!! 16 | _dbTreeInterceptor = new TenantCommandTreeInterceptor(); 17 | DbInterception.Add(_dbTreeInterceptor); 18 | } 19 | 20 | public DbSet MyEntities { get; set; } 21 | 22 | protected override void Dispose(bool disposing) 23 | { 24 | DbInterception.Remove(_dbTreeInterceptor); 25 | 26 | base.Dispose(disposing); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model24_MultiTenantApp/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model24_MultiTenantApp 6 | { 7 | [TestClass] 8 | public class Model24_MultiTenantAppJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model24_MultiTenantApp/MyEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model24_MultiTenantApp 6 | { 7 | [Table("MyEntities24")] 8 | public class MyEntity 9 | { 10 | public int Id { get; set; } 11 | 12 | [Required] 13 | [MaxLength(50)] 14 | public string Description { get; set; } 15 | 16 | [MaxLength(50)] 17 | [DatabaseGenerated(DatabaseGeneratedOption.Computed)] 18 | public string TenantId { get; set; } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model24_MultiTenantApp/Readme.txt: -------------------------------------------------------------------------------- 1 | Original file from 2 | http://xabikos.com/multitenant/application%20design/software%20as%20a%20service/2014/11/17/create-a-multitenant-application-with-entity-framework-code-first---part-1.html 3 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model24_MultiTenantApp/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model24_MultiTenantApp 7 | { 8 | public abstract class Test 9 | { 10 | protected abstract DbConnection GetConnection(); 11 | 12 | [TestMethod] 13 | public void Run() 14 | { 15 | 16 | using (DbConnection connection = GetConnection()) 17 | using (Context context = new Context(connection)) 18 | { 19 | 20 | MyEntity myNewEntity; 21 | 22 | context.MyEntities.Add(myNewEntity = new MyEntity() 23 | { 24 | Description = "My first message" 25 | }); 26 | context.SaveChanges(); 27 | 28 | Console.WriteLine("{0} {1}", myNewEntity.Id, myNewEntity.TenantId); 29 | 30 | } 31 | 32 | 33 | 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model25_InheritTPH/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model25_InheritTPH 6 | { 7 | [TestClass] 8 | public class Model25_InheritTPHJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model25_InheritTPH/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model29_InheritTPH 5 | { 6 | //Not mapped to table, has all fields apart from foreign key 7 | public abstract class FirstBaseModel 8 | { 9 | public int Id { get; set; } 10 | } 11 | 12 | //Mapped to a table, has foreign key (eg. customerId) 13 | [Table("MyTable")] 14 | public class Derived1Model : FirstBaseModel 15 | { 16 | public string D1 { get; set; } 17 | } 18 | 19 | //Mapped to a different table, has foreign key (eg. companyId) 20 | [Table("MyDifferentTable")] 21 | public class Derived2Model : FirstBaseModel 22 | { 23 | public string D2 { get; set; } 24 | } 25 | 26 | //Mapped to the same table as Derived2Model 27 | [Table("MyDifferentTable")] 28 | public class Derived3Model : Derived2Model 29 | { 30 | public string D3 { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model25_InheritTPH/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model25_InheritTPH 7 | { 8 | public abstract class Test 9 | { 10 | 11 | protected abstract DbConnection GetConnection(); 12 | 13 | [TestMethod] 14 | public void Run() 15 | { 16 | using (DbConnection connection = GetConnection()) 17 | using (Context context = new Context(connection)) 18 | { 19 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed 20 | context.M1s.FirstOrDefault(); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model25_InheritTPT/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model25_InheritTPT 6 | { 7 | public class Context : DbContext 8 | { 9 | 10 | public Context(DbConnection connection) 11 | : base(connection, false) 12 | { 13 | } 14 | 15 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 16 | { 17 | base.OnModelCreating(modelBuilder); 18 | modelBuilder.Configurations.Add(new CompanyMap()); 19 | modelBuilder.Configurations.Add(new SupplierMap()); 20 | } 21 | 22 | 23 | public DbSet Companies { get; set; } 24 | public DbSet Suppliers { get; set; } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model25_InheritTPT/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model25_InheritTPT 6 | { 7 | [TestClass] 8 | public class Model25_InheritTPTJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model25_InheritTPT/Mapping.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Entity.ModelConfiguration; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model25_InheritTPT 5 | { 6 | public class CompanyMap : EntityTypeConfiguration 7 | { 8 | public CompanyMap() 9 | { 10 | // Primary Key 11 | HasKey(c => c.Id); 12 | 13 | //Table 14 | ToTable("Company"); 15 | 16 | } 17 | } 18 | 19 | public class SupplierMap : EntityTypeConfiguration 20 | { 21 | public SupplierMap() 22 | { 23 | // Primary Key 24 | HasKey(s => s.Id); 25 | 26 | // Properties 27 | 28 | //Relationship 29 | HasRequired(s => s.Company) 30 | .WithMany().HasForeignKey(c => c.CompanyId); 31 | 32 | //Table 33 | ToTable("Supplier"); 34 | 35 | } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model25_InheritTPT/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model25_InheritTPT 4 | { 5 | public class Company 6 | { 7 | public int Id { get; set; } 8 | public string Name { get; set; } 9 | public DateTime CreatedOn { get; set; } 10 | public DateTime? DeactivatedOn { get; set; } 11 | public DateTime? UpdatedOn { get; set; } 12 | public bool IsActive { get; set; } 13 | } 14 | 15 | public class Supplier : Company 16 | { 17 | public int ContactId { get; set; } 18 | public int DocumentId { get; set; } 19 | public int CompanyId { get; set; } 20 | public virtual Company Company { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model26_Decompile/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model26_Decompile 6 | { 7 | [TestClass] 8 | public class Model26_DecompileJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model26_Decompile/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model26_Decompile 6 | { 7 | public abstract class Test 8 | { 9 | protected abstract DbConnection GetConnection(); 10 | 11 | [TestMethod] 12 | public void Run() 13 | { 14 | using (DbConnection connection = GetConnection()) 15 | using (ParentChildModel context = new ParentChildModel(connection)) 16 | { 17 | //var decompiled = 18 | // context.Parents.Where(p => p.Children.Any(c => c.FullName.StartsWith("A"))).Decompile(); 19 | 20 | } 21 | } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model27_SimpleTest/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model27_SimpleTest 6 | { 7 | [TestClass] 8 | public class Model27_SimpleTestJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model27_SimpleTest/MyDbContext.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model27_SimpleTest 5 | { 6 | class MyDbContext : DbContext 7 | { 8 | public MyDbContext(DbConnection connection) 9 | : base(connection, false) 10 | {} 11 | public DbSet Users { get; set; } 12 | public DbSet Vehicles { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model27_SimpleTest/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model27_SimpleTest 6 | { 7 | public abstract class Test 8 | { 9 | 10 | protected abstract DbConnection GetConnection(); 11 | 12 | [TestMethod] 13 | public void Run() 14 | { 15 | using (DbConnection connection = GetConnection()) 16 | using (MyDbContext dbContext = new MyDbContext(connection)) 17 | { 18 | dbContext.Users.Add(new User { Email = "x@b.com", Name = "x" }); 19 | dbContext.Users.Add(new User { Email = "x@b.com", Name = "x" }); 20 | dbContext.Vehicles.Add(new Vehicle { BuildYear = 2016, Model = "BMW X4" }); 21 | dbContext.SaveChanges(); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model27_SimpleTest/User.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model27_SimpleTest 5 | { 6 | [Table("User27")] 7 | class User 8 | { 9 | public int Id { get; set; } 10 | public string Name { get; set; } 11 | public string Email { get; set; } 12 | public virtual ICollection Vehicles { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model27_SimpleTest/Vehicle.cs: -------------------------------------------------------------------------------- 1 | namespace JetEntityFrameworkProvider.Test.Model27_SimpleTest 2 | { 3 | class Vehicle 4 | { 5 | public int Id { get; set; } 6 | public int? UserId { get; set; } 7 | public string Model { get; set; } 8 | public int BuildYear { get; set; } 9 | public virtual User User { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model28/Helpers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model28 4 | { 5 | static class Helpers 6 | { 7 | public static string Truncate(this string value, int length) 8 | { 9 | if (value.Length < length) 10 | return value; 11 | else 12 | return value.Substring(0, length); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model28/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model28 6 | { 7 | [TestClass] 8 | public class Model28_SimpleTestJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return JetEntityFrameworkProvider.Test.Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model30/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model30 6 | { 7 | class Context : DbContext 8 | { 9 | 10 | public Context(DbConnection connection) 11 | : base(connection, false) 12 | { 13 | } 14 | 15 | public DbSet Answers { get; set; } 16 | public DbSet Questions { get; set; } 17 | 18 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 19 | { 20 | modelBuilder.Entity() 21 | .HasMany(q => q.Answers) 22 | .WithOptional(x => x.Question); 23 | 24 | base.OnModelCreating(modelBuilder); 25 | 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model30/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model30 6 | { 7 | [TestClass] 8 | public class Model30_SimpleTestJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model30/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model30 6 | { 7 | public class Answer 8 | { 9 | [Key] 10 | public int AnswerId { get; set; } 11 | public string AnswerText { get; set; } 12 | //public int Question_QuestionId { get; set; } 13 | public virtual Question Question { get; set; } 14 | } 15 | 16 | 17 | public class Question 18 | { 19 | [Key] 20 | public int QuestionId { get; set; } 21 | public string QuestionText { get; set; } 22 | public virtual Answer CorrectAnswer { get; set; } 23 | public virtual List Answers { get; set; } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model30/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model30 7 | { 8 | public abstract class Test 9 | { 10 | protected abstract DbConnection GetConnection(); 11 | 12 | [TestMethod] 13 | public void Run() 14 | { 15 | using (DbConnection connection = GetConnection()) 16 | using (Context context = new Context(connection)) 17 | { 18 | var answers = context.Answers.Where(x => x.Question.QuestionId == 12).ToList(); 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model31_DoubleReference/Context.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model31_DoubleReference 5 | { 6 | class Context : DbContext 7 | { 8 | 9 | public Context(DbConnection connection) 10 | : base(connection, false) 11 | { 12 | } 13 | 14 | public DbSet People { get; set; } 15 | public DbSet PhoneNumbers { get; set; } 16 | 17 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 18 | { 19 | modelBuilder.Entity().HasOptional(e => e.Person).WithMany(e => e.PhoneNumbers); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model31_DoubleReference/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model31_DoubleReference 6 | { 7 | [TestClass] 8 | public class Model31_DoubleReferenceJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model31_DoubleReference/Model.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model31_DoubleReference 6 | { 7 | [Table("Person31")] 8 | public class Person //This maps to a view in the database 9 | { 10 | [Key] 11 | public int PersonId { get; set; } 12 | public string Name { get; set; } 13 | 14 | public virtual ICollection PhoneNumbers { get; set; } 15 | public virtual PhoneNumber MainPhoneNumber { get; set; } 16 | } 17 | 18 | public class PhoneNumber //maps to a table 19 | { 20 | [Key] 21 | public int PersonPhoneId { get; set; } 22 | public string AreaCode { get; set; } 23 | public string PhoneNo { get; set; } 24 | 25 | public virtual Person Person { get; set; } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model31_DoubleReference/Test.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Linq; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model31_DoubleReference 6 | { 7 | public abstract class Test 8 | { 9 | protected abstract DbConnection GetConnection(); 10 | 11 | [TestMethod] 12 | public void Run() 13 | { 14 | using (DbConnection connection = GetConnection()) 15 | using (Context context = new Context(connection)) 16 | { 17 | var persons = context.People.Where(x => x.MainPhoneNumber.PersonPhoneId == 12).ToList(); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model32_Include_NotInclude/Context.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model32_Include_NotInclude 5 | { 6 | public class TestContext : DbContext 7 | { 8 | public TestContext(DbConnection connection) : base(connection, false) { } 9 | 10 | public DbSet
Adresses { get; set; } 11 | public DbSet Visits { get; set; } 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model32_Include_NotInclude/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model32_Include_NotInclude 6 | { 7 | [TestClass] 8 | public class Model32_Include_NotIncludeJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model32_Include_NotInclude/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model32_Include_NotInclude 6 | { 7 | [Table("Address32")] 8 | public class Address 9 | { 10 | [Key] 11 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 12 | public int Id { get; set; } 13 | 14 | public string Description { get; set; } 15 | 16 | public virtual Visit Visit { get; set; } 17 | } 18 | 19 | [Table("Visit32")] 20 | public class Visit 21 | { 22 | public Visit() 23 | { 24 | } 25 | 26 | [Key] 27 | [ForeignKey("Address")] 28 | public int Id { get; set; } 29 | 30 | public string Description { get; set; } 31 | 32 | public virtual Address Address { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model33_OneToOneDeleteCascade/Address.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model33_OneToOneDeleteCascade 5 | { 6 | [Table("Address33")] 7 | public class Address 8 | { 9 | public int Id { get; set; } 10 | 11 | public string AddressLines1 { get; set; } 12 | 13 | public string AddressLines2 { get; set; } 14 | 15 | public string AddressLines3 { get; set; } 16 | 17 | public string PostCode { get; set; } 18 | 19 | public virtual Person Person { get; set; } // needed for one to one? 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model33_OneToOneDeleteCascade/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model33_OneToOneDeleteCascade 6 | { 7 | class TestContext : DbContext 8 | { 9 | public TestContext(DbConnection connection) : base(connection, false) { } 10 | 11 | public DbSet Adresses { get; set; } 12 | public DbSet
Visits { get; set; } 13 | 14 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 15 | { 16 | modelBuilder.Entity() 17 | .HasRequired(s => s.Address) 18 | .WithRequiredPrincipal(ad => ad.Person) 19 | .WillCascadeOnDelete(true); 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model33_OneToOneDeleteCascade/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model33_OneToOneDeleteCascade 6 | { 7 | [TestClass] 8 | public class Model33_OneToOneDeleteCascadeJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model33_OneToOneDeleteCascade/Person.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model33_OneToOneDeleteCascade 4 | { 5 | [Table("Person33")] 6 | public class Person 7 | { 8 | public int Id { get; set; } 9 | 10 | public string Name { get; set; } 11 | 12 | public int AddressId { get; set; } // needed for nav? 13 | 14 | public virtual Address Address { get; set; } // nav property 15 | } 16 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model33_OneToOneDeleteCascade/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model33_OneToOneDeleteCascade 7 | { 8 | public abstract class Test 9 | { 10 | protected abstract DbConnection GetConnection(); 11 | 12 | [TestMethod] 13 | public void Run() 14 | { 15 | using (DbConnection connection = GetConnection()) 16 | using (TestContext db = new TestContext(connection)) 17 | { 18 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed 19 | db.Adresses.ToList(); 20 | } 21 | 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model34_JetEfBug/Context.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model34_JetEfBug 5 | { 6 | public class DataContext : DbContext 7 | { 8 | public DataContext(DbConnection connection) : base(connection, false) { } 9 | public DbSet Categories { get; set; } 10 | public DbSet Items { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model34_JetEfBug/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model34_JetEfBug 6 | { 7 | [TestClass] 8 | public class Model34_JetEfBugJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model34_JetEfBug/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model34_JetEfBug 5 | { 6 | public class Category 7 | { 8 | public int ID { get; set; } 9 | public string Name { get; set; } 10 | public virtual ICollection Items { get; set; } 11 | } 12 | public class Item 13 | { 14 | public int ID { get; set; } 15 | public string Name { get; set; } 16 | public virtual Category Category { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model34_JetEfBug/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model34_JetEfBug 7 | { 8 | public abstract class Test 9 | { 10 | protected abstract DbConnection GetConnection(); 11 | 12 | [TestMethod] 13 | public void Run() 14 | { 15 | using (DbConnection connection = GetConnection()) 16 | using (var db = new DataContext(connection)) 17 | { 18 | var categoriesList = db.Categories.Select(c => new { c.ID, c.Name, TotalItems = db.Items.Count(i => i.Category.ID == c.ID) }); 19 | Console.WriteLine(categoriesList); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model35_OneToZeroOneDeleteCascade/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model35_OneToZeroOneDeleteCascade 6 | { 7 | class Context : DbContext 8 | { 9 | public Context(DbConnection connection) : base(connection, false) { } 10 | 11 | public DbSet Principals { get; set; } 12 | public DbSet Dependents { get; set; } 13 | 14 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 15 | { 16 | modelBuilder.Configurations.Add(new PrincipalMap()); 17 | modelBuilder.Configurations.Add(new DependentMap()); 18 | } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model35_OneToZeroOneDeleteCascade/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model35_OneToZeroOneDeleteCascade 6 | { 7 | [TestClass] 8 | public class Model35_OneToZeroOneDeleteCascadeJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model35_OneToZeroOneDeleteCascade/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model35_OneToZeroOneDeleteCascade 4 | { 5 | public class Principal 6 | { 7 | public int Id { get; private set; } 8 | 9 | public virtual Dependent Dependent { get; private set; } 10 | } 11 | 12 | public class Dependent 13 | { 14 | public int Id { get; private set; } 15 | 16 | public virtual Principal Principal { get; private set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model35_OneToZeroOneDeleteCascade/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model35_OneToZeroOneDeleteCascade 7 | { 8 | public abstract class Test 9 | { 10 | protected abstract DbConnection GetConnection(); 11 | 12 | [TestMethod] 13 | public void Run() 14 | { 15 | using (DbConnection connection = GetConnection()) 16 | using (var db = new Context(connection)) 17 | { 18 | var categoriesList = db.Dependents.Count(); 19 | Console.WriteLine(categoriesList); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model36_DetachedScenario/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model36_DetachedScenario 6 | { 7 | class Context : DbContext 8 | { 9 | public Context(DbConnection connection) : base(connection, false) 10 | { 11 | } 12 | 13 | public DbSet Holders { get; set; } 14 | public DbSet Things { get; set; } 15 | 16 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 17 | { 18 | modelBuilder.Entity() 19 | .HasOptional(_ => _.Thing) 20 | .WithMany(_ => _.Holders) 21 | .Map(_ => _.MapKey("ThingId")); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model36_DetachedScenario/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model36_DetachedScenario 6 | { 7 | [TestClass] 8 | public class Model36_DetachedScenarioJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model36_DetachedScenario/Repository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model36_DetachedScenario 4 | { 5 | static class Repository 6 | { 7 | public static void Update(Context context, Holder holder) 8 | { 9 | var thing = holder.Thing; 10 | holder.Thing = new Thing() {Id = 2}; 11 | var attachedHolder = context.Holders.Attach(holder); 12 | attachedHolder.Thing = thing; 13 | context.Entry(holder).Property("Some").IsModified = true; 14 | 15 | //var manager = ((IObjectContextAdapter)context).ObjectContext.ObjectStateManager; 16 | //manager.ChangeRelationshipState(holder, holder.Thing, "Thing", EntityState.Added); 17 | 18 | context.SaveChanges(); 19 | } 20 | 21 | 22 | 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model37_2Contexts/Context1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model37_2Contexts_1 6 | { 7 | class Context1 : DbContext 8 | { 9 | public Context1(DbConnection connection):base(connection, false) 10 | {} 11 | 12 | public DbSet MyEntities { get; set; } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model37_2Contexts/Context2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model37_2Contexts_2 6 | { 7 | class Context2 : DbContext 8 | { 9 | public Context2(DbConnection connection):base(connection, false) 10 | {} 11 | 12 | public DbSet MyEntities { get; set; } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model37_2Contexts/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model37_2Contexts 6 | { 7 | [TestClass] 8 | public class Model37_2ContextsJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model37_2Contexts/Model1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model37_2Contexts_1 6 | { 7 | [Table("Module1MyEntity")] 8 | public class MyEntity 9 | { 10 | public int Id { get; set; } 11 | [MaxLength(50)] 12 | public string Description { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model37_2Contexts/Model2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model37_2Contexts_2 6 | { 7 | [Table("Module2MyEntity")] 8 | public class MyEntity 9 | { 10 | public int Id { get; set; } 11 | [MaxLength(50)] 12 | public string Description { get; set; } 13 | [MaxLength(50)] 14 | public string Description2 { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model38_OneEntity2Tables/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model38_OneEntity2Tables 6 | { 7 | [TestClass] 8 | public class Model38_OneEntity2TablesJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model38_OneEntity2Tables/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model38_OneEntity2Tables 4 | { 5 | public class Student 6 | { 7 | public int Id { get; set; } 8 | public string StudentName { get; set; } 9 | public DateTime? DateOfBirth { get; set; } 10 | public byte[] Photo { get; set; } 11 | public decimal? Height { get; set; } 12 | public float? Weight { get; set; } 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model39_DetachedEntities/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model39_DetachedEntities 6 | { 7 | [TestClass] 8 | public class Model39_DetachedEntitiesJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model39_DetachedEntities/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model39_DetachedEntities 6 | { 7 | public class Grade 8 | { 9 | [Key] 10 | public int Id { get; set; } 11 | 12 | [Required] 13 | [StringLength(100)] 14 | public string Name { get; set; } 15 | 16 | [Required] 17 | public float Quantity { get; set; } 18 | 19 | public ICollection GradeWidths { get; set; } 20 | } 21 | 22 | public class GradeWidth 23 | { 24 | public int Id { get; set; } 25 | public int Width { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model39_DetachedEntities/MyContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model39_DetachedEntities 6 | { 7 | class MyContext : DbContext 8 | { 9 | public MyContext(DbConnection connection) : base(connection, false) 10 | {} 11 | 12 | public DbSet Grades { get; set; } 13 | public DbSet GradeWidths { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model40_HardMapping/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model40_HardMapping 6 | { 7 | [TestClass] 8 | public class Model40_HardMappingJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model40_HardMapping/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model40_HardMapping 7 | { 8 | public abstract class Test 9 | { 10 | protected abstract DbConnection GetConnection(); 11 | 12 | [TestMethod] 13 | public void Run() 14 | { 15 | using (DbConnection connection = GetConnection()) 16 | using (var context = new Context(connection)) 17 | { 18 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed 19 | context.Cars.Count(); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model41/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model41 6 | { 7 | [TestClass] 8 | public class Model41JetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model41/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model41 7 | { 8 | public abstract class Test 9 | { 10 | protected abstract DbConnection GetConnection(); 11 | 12 | [TestMethod] 13 | public void Run() 14 | { 15 | using (DbConnection connection = GetConnection()) 16 | using (var context = new DemoContext(connection)) 17 | { 18 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed 19 | context.Applicants.Count(); 20 | //context.Applicants.AsQueryable().Where("Ciao"); 21 | 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model42/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model42 6 | { 7 | class Context : DbContext 8 | { 9 | public Context(DbConnection connection) : base(connection, false) 10 | { 11 | 12 | } 13 | 14 | public DbSet Foos { get; set; } 15 | public DbSet Bars { get; set; } 16 | 17 | 18 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 19 | { 20 | modelBuilder.Entity() 21 | .HasMany(_ => _.Bars) 22 | .WithMany(_ => _.Foos); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model42/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model42 6 | { 7 | [TestClass] 8 | public class Model42JetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model42/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model42 5 | { 6 | public class Foo 7 | { 8 | public int FooId { get; set; } 9 | public virtual ICollection Bars { get; set; } 10 | } 11 | 12 | public class Bar 13 | { 14 | public int BarId { get; set; } 15 | public virtual Foo DefaultFoo { get; set; } 16 | public virtual ICollection Foos { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model43_PKasFK/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model43_PKasFK 6 | { 7 | class Context : DbContext 8 | { 9 | public Context(DbConnection connection) : base(connection, false) 10 | { 11 | 12 | } 13 | 14 | public DbSet Parents { get; set; } 15 | public DbSet Children { get; set; } 16 | 17 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 18 | { 19 | modelBuilder.Entity() 20 | .HasMany(_ => _.Children) 21 | .WithRequired(_ => _.Parent) 22 | .HasForeignKey(_ => _.ParentName); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model43_PKasFK/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model43_PKasFK 6 | { 7 | [TestClass] 8 | public class Model43_PKasFKJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model43_PKasFK/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model43_PKasFK 7 | { 8 | public class Parent 9 | { 10 | [Key] 11 | public string Name { get; set; } 12 | 13 | public virtual List Children { get; set; } 14 | } 15 | 16 | public class Child 17 | { 18 | [Key] 19 | [Column(Order = 1)] 20 | public string ParentName { get; set; } 21 | 22 | [Key] 23 | [Column(Order = 2)] 24 | public string ChildName { get; set; } 25 | 26 | public virtual Parent Parent { get; set; } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model43_PKasFK/ParentsHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model43_PKasFK 4 | { 5 | static class ParentsHelper 6 | { 7 | public static void AddOrUpdate(this Context context, string name, Parent parent) 8 | { 9 | var dbParent = context.Parents.Find(name); 10 | if (dbParent == null) 11 | context.Parents.Add(parent); 12 | else 13 | throw new NotImplementedException(); 14 | 15 | context.SaveChanges(); 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model44_CaseSensitivity/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model44_CaseSensitivity 6 | { 7 | class Context : DbContext 8 | { 9 | public Context(DbConnection connection) : base(connection, false) 10 | { 11 | 12 | } 13 | 14 | public DbSet Entities { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model44_CaseSensitivity/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity.Infrastructure; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model44_CaseSensitivity 7 | { 8 | [TestClass] 9 | public class Model44_CaseSensitivityJetTest : Test 10 | { 11 | protected override DbConnection GetConnection() 12 | { 13 | return Helpers.GetJetConnection(); 14 | } 15 | 16 | [TestMethod] 17 | [ExpectedException(typeof(DbUpdateException))] 18 | public override void Run() 19 | { 20 | base.Run(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model44_CaseSensitivity/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model44_CaseSensitivity 6 | { 7 | [Table("Entities44")] 8 | public class Entity 9 | { 10 | [Key] 11 | public string Name { get; set; } 12 | 13 | [MaxLength(50)] 14 | public string Description { get; set; } 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model44_CaseSensitivity/SqlCeTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model44_CaseSensitivity 6 | { 7 | [TestClass] 8 | public class Model44_CaseSensitivityCeTest : Test 9 | { 10 | 11 | [TestMethod] 12 | public override void Run() 13 | { 14 | // The SQL CE Connection is configured as case sensitive so 15 | // this test should work properly 16 | base.Run(); 17 | } 18 | 19 | protected override DbConnection GetConnection() 20 | { 21 | return Helpers.GetSqlCeConnection(); 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model44_CaseSensitivity/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model44_CaseSensitivity 6 | { 7 | public abstract class Test 8 | { 9 | 10 | protected abstract DbConnection GetConnection(); 11 | 12 | 13 | public virtual void Run() 14 | { 15 | using (DbConnection connection = GetConnection()) 16 | using (var context = new Context(connection)) 17 | { 18 | context.Entities.Add(new Entity() { Name = "Duplicated" }); 19 | context.Entities.Add(new Entity() { Name = "DUPLICATED" }); 20 | context.SaveChanges(); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model45_InheritTPHWithSameRelationship/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model45_InheritTPHWithSameRelationship 6 | { 7 | [TestClass] 8 | public class Model45_InheritTPHWithSameRelationshipJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model45_InheritTPHWithSameRelationship/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JetEntityFrameworkProvider.Test.Model45_InheritTPHWithSameRelationship 4 | { 5 | public abstract class Base 6 | { 7 | public int Id { get; set; } 8 | public string Description { get; set; } 9 | } 10 | 11 | public class Inherited1 : Base 12 | { 13 | public virtual Type1 Rel { get; set; } 14 | } 15 | 16 | public class Inherited2 : Base 17 | { 18 | public virtual Type1 Rel { get; set; } 19 | } 20 | 21 | public class Type1 22 | { 23 | public int Id { get; set; } 24 | public int Description { get; set; } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model45_InheritTPHWithSameRelationship/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity.ModelConfiguration; 4 | using System.Linq; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | 7 | namespace JetEntityFrameworkProvider.Test.Model45_InheritTPHWithSameRelationship 8 | { 9 | public abstract class Test 10 | { 11 | protected abstract DbConnection GetConnection(); 12 | 13 | // Actually this test does not work 14 | [TestMethod] 15 | [ExpectedException(typeof(ModelValidationException))] 16 | public void Run() 17 | { 18 | using (DbConnection connection = GetConnection()) 19 | using (Context context = new Context(connection)) 20 | { 21 | context.M1s.FirstOrDefault(); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model46_InnerClasses/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model46_InnerClasses 6 | { 7 | class Context : DbContext 8 | { 9 | public Context(DbConnection connection) : base(connection, false) 10 | {} 11 | 12 | public DbSet ClassAs { get; set; } 13 | 14 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 15 | { 16 | base.OnModelCreating(modelBuilder); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model46_InnerClasses/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model46_InnerClasses 6 | { 7 | [TestClass] 8 | public class Model46_InnerClassesJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model46_InnerClasses/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model46_InnerClasses 6 | { 7 | [Table("ClassA46")] 8 | public class ClassA 9 | { 10 | public ClassA() 11 | { 12 | B = new ClassB(); 13 | C = new ClassC(); 14 | } 15 | 16 | [Key] 17 | public int id { get; set; } 18 | public int x { get; set; } 19 | public int y { get; set; } 20 | 21 | public virtual ClassB B { get; set; } 22 | public virtual ClassC C { get; set; } 23 | 24 | [ComplexType] 25 | public class ClassB 26 | { 27 | public int? b { get; set; } 28 | } 29 | 30 | [ComplexType] 31 | public class ClassC 32 | { 33 | public int? c { get; set; } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model47_200/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model47_200 6 | { 7 | class Context : DbContext 8 | { 9 | public Context(DbConnection connection) : base(connection, false) 10 | {} 11 | 12 | public DbSet Depts { get; set; } 13 | public DbSet Emps { get; set; } 14 | 15 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 16 | { 17 | modelBuilder.Entity() 18 | .HasRequired(_ => _.Manager) 19 | .WithRequiredDependent(_ => _.Department); 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model47_200/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model47_200 6 | { 7 | [TestClass] 8 | public class Model47_200JetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model47_200/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model47_200 5 | { 6 | public class Dept 7 | { 8 | [Key] 9 | public int DeptId { get; set; } 10 | 11 | public Emp Manager { get; set; } 12 | 13 | public string DeptName { get; set; } 14 | } 15 | 16 | public class Emp 17 | { 18 | [Key] 19 | public int EmpId { get; set; } 20 | 21 | public Dept Department { get; set; } 22 | 23 | public string Name { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model47_200/MyContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model47_200 5 | { 6 | class MyContext : DbContext 7 | { 8 | public string Schema { get; private set; } 9 | 10 | public MyContext(string schema) : base() 11 | { 12 | 13 | } 14 | 15 | // Your DbSets here 16 | DbSet Emps { get; set; } 17 | 18 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 19 | { 20 | modelBuilder.Entity() 21 | .ToTable("Emps", Schema); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model47_200/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model47_200 7 | { 8 | public abstract class Test 9 | { 10 | protected abstract DbConnection GetConnection(); 11 | 12 | 13 | [TestMethod] 14 | public void Run() 15 | { 16 | using (DbConnection connection = GetConnection()) 17 | using (var context = new Context(connection)) 18 | { 19 | context.Depts.Count(); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model48_Cast/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model48_Cast 6 | { 7 | class Context : DbContext 8 | { 9 | public Context(DbConnection connection) : base(connection, false) 10 | {} 11 | 12 | public DbSet Entities { get; set; } 13 | 14 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 15 | { 16 | base.OnModelCreating(modelBuilder); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model48_Cast/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model48_Cast 6 | { 7 | [TestClass] 8 | public class Model48_CastJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model48_Cast/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model48_Cast 5 | { 6 | [Table("Entities48")] 7 | public class Entity 8 | { 9 | public string Id { get; set; } 10 | public int? Number { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model49_Inheritance_EagerlyLoad/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model49_Inheritance_EagerlyLoad 6 | { 7 | class Context : DbContext 8 | { 9 | public Context(DbConnection connection) : base(connection, false) 10 | {} 11 | 12 | public DbSet A { get; set; } 13 | 14 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 15 | { 16 | base.OnModelCreating(modelBuilder); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model49_Inheritance_EagerlyLoad/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model49_Inheritance_EagerlyLoad 6 | { 7 | [TestClass] 8 | public class Model49_Inheritance_EagerlyLoadJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model49_Inheritance_EagerlyLoad/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model49_Inheritance_EagerlyLoad 6 | { 7 | public class A 8 | { 9 | public string Id { get; set; } 10 | public IList Bases { get; set; } 11 | } 12 | 13 | public abstract class Base 14 | { 15 | [Key] 16 | public int BaseId { get; set; } 17 | public string Name { get; set; } 18 | } 19 | 20 | public abstract class Base1 : Base 21 | { 22 | public string SomeClass { get; set; } 23 | } 24 | 25 | public class Base2 : Base1 26 | { 27 | 28 | } 29 | 30 | public class Base3 : Base1 31 | { 32 | public string SomeOtherClass { get; set; } 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model50_Interception/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | using System.Data.Entity.Infrastructure.Interception; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model50_Interception 7 | { 8 | class Context : DbContext 9 | { 10 | public Context(DbConnection connection) 11 | : base(connection, false) 12 | { } 13 | 14 | static Context() 15 | { 16 | DbInterception.Add(new CommandInterceptor()); 17 | } 18 | 19 | 20 | public DbSet Notes { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model50_Interception/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model50_Interception 6 | { 7 | [TestClass] 8 | public class Model50_InterceptionJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model50_Interception/LanguageExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model50_Interception 5 | { 6 | static class LanguageExtensions 7 | { 8 | public static bool In(this T source, params T[] list) 9 | { 10 | return (list as IList).Contains(source); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model50_Interception/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model50_Interception 5 | { 6 | public class Note 7 | { 8 | public int Id { get; set; } 9 | [MaxLength(250)] 10 | public string NoteText { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model50_Interception/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model50_Interception 7 | { 8 | public abstract class Test 9 | { 10 | protected abstract DbConnection GetConnection(); 11 | 12 | [TestMethod] 13 | public void Run() 14 | { 15 | using (DbConnection connection = GetConnection()) 16 | using (var context = new Context(connection)) 17 | { 18 | // With literals parameters are not generated 19 | context.Notes.Where(_ => _.Id == 12).Count(); // No parameters 20 | context.Notes.Where(_ => _.Id == 12 + 1).Count(); // No parameters 21 | int a = 12; 22 | context.Notes.Where(_ => _.Id == a).Count(); // Yes parameters 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model51_1_Many_RemoveChildren/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model51_1_Many_RemoveChildren 6 | { 7 | class Context : DbContext 8 | { 9 | public Context(DbConnection connection) : base(connection, false) 10 | {} 11 | 12 | public DbSet Blogs { get; set; } 13 | public DbSet Posts { get; set; } 14 | 15 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 16 | { 17 | base.OnModelCreating(modelBuilder); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model51_1_Many_RemoveChildren/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model51_1_Many_RemoveChildren 6 | { 7 | [TestClass] 8 | public class Model51_1_Many_RemoveChildrenJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model51_1_Many_RemoveChildren/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model51_1_Many_RemoveChildren 6 | { 7 | [Table("Blogs51")] 8 | public class Blog 9 | { 10 | public Blog() 11 | { 12 | Posts = new List(); 13 | } 14 | 15 | public int Id { get; set; } 16 | public string Name { get; set; } 17 | public virtual ICollection Posts { get; set; } 18 | } 19 | 20 | [Table("Posts51")] 21 | public class Post 22 | { 23 | public int Id { get; set; } 24 | 25 | // foreign key to Blog: 26 | public int BlogId { get; set; } 27 | public virtual Blog Blog { get; set; } 28 | 29 | public string Title { get; set; } 30 | public string Text { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model52_Requires_HasFalse_LogicalDelete/PanelLookup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model52_Requires_HasFalse_LogicalDelete 6 | { 7 | [Table("PanelLookup")] 8 | public class PanelLookup 9 | { 10 | [Column("Id")] 11 | public int Id { get; set; } 12 | 13 | [Column("Name")] 14 | public string Name { get; set; } 15 | 16 | public virtual ICollection PanelTextures { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model52_Requires_HasFalse_LogicalDelete/PanelTexture.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model52_Requires_HasFalse_LogicalDelete 5 | { 6 | 7 | [Table("PanelTexture")] 8 | public class PanelTexture 9 | { 10 | [Column("PanelId")] 11 | public int PanelId { get; set; } 12 | 13 | public virtual PanelLookup PanelLookup { get; set; } 14 | 15 | [Column("TextureId")] 16 | public int TextureId { get; set; } 17 | 18 | public bool IsInterior { get; set; } 19 | 20 | public virtual Texture Texture { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model52_Requires_HasFalse_LogicalDelete/Texture.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model52_Requires_HasFalse_LogicalDelete 6 | { 7 | [Table("Texture")] 8 | public class Texture 9 | { 10 | [Column("ID")] 11 | public int Id { get; set; } 12 | 13 | [Column("DisplayText")] 14 | public string DisplayText { get; set; } 15 | 16 | [Column("IsDeleted")] 17 | public bool IsDeleted { get; set; } 18 | 19 | public virtual ICollection PanelTextures { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model53_TableSplitting/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model53_TableSplitting 6 | { 7 | [TestClass] 8 | public class Model53_TableSplittingTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model53_TableSplitting/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model53_TableSplitting 6 | { 7 | public class Person 8 | { 9 | public int PersonID { get; set; } 10 | public string Name { get; set; } 11 | public virtual Address Address { get; set; } 12 | } 13 | public class Address 14 | { 15 | public Int32 PersonID { get; set; } 16 | public string Province { get; set; } 17 | public virtual Person Person { get; set; } 18 | public virtual City City { get; set; } 19 | 20 | } 21 | 22 | public class City 23 | { 24 | public Int32 CityID { get; set; } 25 | public string Name { get; set; } 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model53_TableSplitting/readme.txt: -------------------------------------------------------------------------------- 1 | This is a solution for "Complex type cannot contain navigation properties" 2 | https://msdn.microsoft.com/en-us/library/bb738472.aspx 3 | http://stackoverflow.com/questions/42403179/how-do-i-have-class-properties-with-navigational-props-as-entity-properties-c 4 | 5 | With this model, also removing the navigation property from Address to Person (with complex type you don't have this feature), you need to have an Address class for each entity that use it (for example one for Person like in this case, one for Customer and so on). 6 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model54_MemoryLeakageTest/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model54_MemoryLeakageTest 6 | { 7 | public class Context : System.Data.Entity.DbContext 8 | { 9 | // For migration test 10 | public Context() 11 | { } 12 | 13 | 14 | public Context(DbConnection connection) 15 | : base(connection, false) 16 | {} 17 | public DbSet Students { get; set; } 18 | public DbSet Standards { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model54_MemoryLeakageTest/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model54_MemoryLeakageTest 6 | { 7 | [TestClass] 8 | public class Model54_MemoryLeakageTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model54_MemoryLeakageTest/Standard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model54_MemoryLeakageTest 6 | { 7 | public class Standard 8 | { 9 | public Standard() 10 | { 11 | Students = new List(); 12 | } 13 | 14 | [Index("MultipleColumnIndex", 2)] 15 | public int StandardId { get; set; } 16 | [Index("MultipleColumnIndex", 1)] 17 | public string StandardName { get; set; } 18 | public string Description { get; set; } 19 | 20 | public virtual ICollection Students { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model54_MemoryLeakageTest/Student.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model54_MemoryLeakageTest 6 | { 7 | public class Student 8 | { 9 | public int StudentId { get; set; } 10 | 11 | [Required] 12 | [MaxLength(50)] 13 | [Index] 14 | public string StudentName { get; set; } 15 | 16 | public string Notes { get; set; } 17 | 18 | public virtual Standard Standard { get; set; } 19 | 20 | public override string ToString() 21 | { 22 | return string.Format("{2}: {0} - {1}", StudentId, StudentName, base.ToString()); 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model55_Unicode/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model55_Unicode 6 | { 7 | public class Context : System.Data.Entity.DbContext 8 | { 9 | // For migration test 10 | public Context() 11 | { } 12 | 13 | 14 | public Context(DbConnection connection) 15 | : base(connection, false) 16 | { } 17 | public DbSet Entities { get; set; } 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model55_Unicode/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model55_Unicode 6 | { 7 | [TestClass] 8 | public class Model55_UnicodeJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model55_Unicode/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model55_Unicode 6 | { 7 | [Table("Model55Entity")] 8 | public class Entity 9 | { 10 | public int Id { get; set; } 11 | [MaxLength(50)] 12 | public string Description { get; set; } 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model56_SkipTake/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model56_SkipTake 6 | { 7 | public class Context : DbContext 8 | { 9 | // For migration test 10 | public Context() 11 | { } 12 | 13 | 14 | public Context(DbConnection connection) 15 | : base(connection, false) 16 | { } 17 | public DbSet Entities { get; set; } 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model56_SkipTake/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model56_SkipTake 6 | { 7 | [TestClass] 8 | public class Model56_SkipTake_JetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model56_SkipTake/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model56_SkipTake 6 | { 7 | [Table("Model56Entity")] 8 | public class Entity 9 | { 10 | public int Id { get; set; } 11 | [MaxLength(50)] 12 | public string Description { get; set; } 13 | public DateTime? Date { get; set; } 14 | public double? Value { get; set; } 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model56_SkipTake/SqlCeTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model56_SkipTake 6 | { 7 | [TestClass] 8 | public class Model56_SkipTake_SqlCeTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetSqlCeConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model57_StackOverflow/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | // https://stackoverflow.com/questions/44809921/duplicate-values-in-the-index-primary-key-or-relationship 6 | 7 | namespace JetEntityFrameworkProvider.Test.Model57_StackOverflow 8 | { 9 | public class Context : DbContext 10 | { 11 | // For migration test 12 | public Context() 13 | { } 14 | 15 | 16 | public Context(DbConnection connection) 17 | : base(connection, false) 18 | { } 19 | public DbSet Pages { get; set; } 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model57_StackOverflow/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model57_StackOverflow 6 | { 7 | [TestClass] 8 | public class Model57_StackOverflow : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model57_StackOverflow/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model57_StackOverflow 5 | { 6 | [Table("StackOverflow44809921")] 7 | public class Page 8 | { 9 | public int Id { get; set; } 10 | public int? PageNumber { get; set; } 11 | [Index(IsUnique = true)] 12 | public int? BookNumber { get; set; } 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model58_TruncateTime/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model58_TruncateTime 6 | { 7 | public class Context : DbContext 8 | { 9 | // For migration test 10 | public Context() 11 | { } 12 | 13 | 14 | public Context(DbConnection connection) 15 | : base(connection, false) 16 | { } 17 | public DbSet Entities { get; set; } 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model58_TruncateTime/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model58_TruncateTime 6 | { 7 | [TestClass] 8 | public class Model58_TruncateTime : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model58_TruncateTime/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model58_TruncateTime 5 | { 6 | [Table("Model58")] 7 | public class Entity 8 | { 9 | public int Id { get; set; } 10 | public DateTime Date { get; set; } 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model59_StackOverflow_TPT_TPH/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | // https://stackoverflow.com/questions/44923674/ef-code-first-multi-level-inheritence-issues 6 | 7 | namespace JetEntityFrameworkProvider.Test.Model59_StackOverflow_TPT_TPH 8 | { 9 | public class Context : DbContext 10 | { 11 | public Context() 12 | { } 13 | 14 | 15 | public Context(DbConnection connection) 16 | : base(connection, false) 17 | { } 18 | 19 | public DbSet Activity { get; set; } // To have a table named Activity as required 20 | public DbSet DataCaptureActivities { get; set; } 21 | public DbSet MasterDataCaptureActivities { get; set; } 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model59_StackOverflow_TPT_TPH/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model59_StackOverflow_TPT_TPH 6 | { 7 | [TestClass] 8 | public class Model59_StackOverflow_JetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model59_StackOverflow_TPT_TPH/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model59_StackOverflow_TPT_TPH 6 | { 7 | public abstract class Test 8 | { 9 | protected abstract DbConnection GetConnection(); 10 | 11 | [TestMethod] 12 | public void Run() 13 | { 14 | using (var context = new Context(GetConnection())) 15 | { 16 | context.DataCaptureActivities.Add(new DataCaptureActivity() {Description = "Description"}); 17 | context.SaveChanges(); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model60_StackOverflow_m2n_Person_Book/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model60_StackOverflow_m2n_Person_Book 6 | { 7 | [TestClass] 8 | public class Model60_StackOverflow_JetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model61_StackOverflow_Seed/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | // https://stackoverflow.com/questions/44972714/ef-seed-table-with-foreign-key 6 | 7 | namespace JetEntityFrameworkProvider.Test.Model61_StackOverflow_Seed 8 | { 9 | public class Context : DbContext 10 | { 11 | public Context() 12 | { } 13 | 14 | 15 | public Context(DbConnection connection) 16 | : base(connection, false) 17 | { } 18 | 19 | public DbSet ClassRooms { get; set; } 20 | public DbSet ClassSchedules { get; set; } 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model61_StackOverflow_Seed/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model61_StackOverflow_Seed 6 | { 7 | [TestClass] 8 | public class Model61_StackOverflow_JetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model61_StackOverflow_Seed/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model61_StackOverflow_Seed 5 | { 6 | 7 | public class ClassRoom 8 | { 9 | public ClassRoom() 10 | { 11 | this.ClassSchedules = new HashSet(); 12 | } 13 | 14 | public int Id { get; set; } 15 | public string ClassRoomName { get; set; } 16 | public int MaxStudents { get; set; } 17 | 18 | public ICollection ClassSchedules { get; set; } 19 | } 20 | public class ClassSchedule 21 | { 22 | public int Id { get; set; } 23 | public string ScheduleName { get; set; } 24 | public DateTime StartTime { get; set; } 25 | public DateTime EndTime { get; set; } 26 | 27 | public virtual ClassRoom ClassRooms { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model62_InnerQueryBug_DbInitializerSeed/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model62_InnerQueryBug_DbInitializerSeed 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context() 10 | { } 11 | 12 | 13 | public Context(DbConnection connection) 14 | : base(connection, false) 15 | { } 16 | 17 | public DbSet Items { get; set; } 18 | public DbSet Sales { get; set; } 19 | public DbSet SaleDetails { get; set; } 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model62_InnerQueryBug_DbInitializerSeed/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model62_InnerQueryBug_DbInitializerSeed 6 | { 7 | [TestClass] 8 | public class Model62_InnerQueryBug_JetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model62_InnerQueryBug_DbInitializerSeed/SqlCeTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model62_InnerQueryBug_DbInitializerSeed 6 | { 7 | //[TestClass] 8 | public class Model62_InnerQueryBug_SqlCeTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetSqlCeConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model62_InnerQueryBug_DbInitializerSeed/SqlServerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model62_InnerQueryBug_DbInitializerSeed 6 | { 7 | //[TestClass] 8 | public class Model62_InnerQueryBug_SqlServerTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetSqlServerConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model63_Time/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model63_Time 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context() 10 | { } 11 | 12 | 13 | public Context(DbConnection connection) 14 | : base(connection, false) 15 | { } 16 | 17 | public DbSet Items { get; set; } 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model63_Time/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model63_Time 6 | { 7 | [TestClass] 8 | public class Model63_Time_JetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model63_Time/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model63_Time 5 | { 6 | [Table("Items63")] 7 | public class Item 8 | { 9 | public int Id { get; set; } 10 | public TimeSpan? TimeSpan { get; set; } 11 | public DateTime? DateTime { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model64_Schema/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model64_Schema 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context() 10 | { } 11 | 12 | 13 | public Context(DbConnection connection) 14 | : base(connection, false) 15 | { } 16 | 17 | public DbSet Items { get; set; } 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model64_Schema/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model64_Schema 6 | { 7 | [TestClass] 8 | public class Model64_Schema : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model64_Schema/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model64_Schema 6 | { 7 | [Table("Jet.TableWithSchema")] 8 | public class Item 9 | { 10 | public int Id { get; set; } 11 | [MaxLength(50)] 12 | public string Description { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model65_InMemoryObjects/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model65_InMemoryObjects 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context() 10 | { } 11 | 12 | 13 | public Context(DbConnection connection) 14 | : base(connection, false) 15 | { } 16 | 17 | public DbSet Items { get; set; } 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model65_InMemoryObjects/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model65_InMemoryObjects 6 | { 7 | [TestClass] 8 | public class Model65_InMemoryObjects : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model65_InMemoryObjects/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model65_InMemoryObjects 6 | { 7 | [Table("Items65")] 8 | public class Item 9 | { 10 | public int Id { get; set; } 11 | [MaxLength(50)] 12 | public string Description { get; set; } 13 | 14 | public virtual Item ReferencedItem { get; set; } 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model66_StackOverflow_TooManyColumns/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model66_StackOverflow_TooManyColumns 6 | { 7 | [TestClass] 8 | public class Model66_StackOverflow_TooManyColumns : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model66_StackOverflow_TooManyColumns/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model66_StackOverflow_TooManyColumns 7 | { 8 | public abstract class Test 9 | { 10 | protected abstract DbConnection GetConnection(); 11 | 12 | [TestMethod] 13 | public void Run() 14 | { 15 | using (var context = new Context(GetConnection())) 16 | { 17 | context.FasleManJdls.ToList(); 18 | } 19 | } 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model67_DifferentProxies/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model67_DifferentProxies 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context() 10 | { } 11 | 12 | 13 | public Context(DbConnection connection) 14 | : base(connection, true) 15 | { } 16 | 17 | public DbSet People { get; set; } 18 | public DbSet Infos { get; set; } 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model67_DifferentProxies/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model67_DifferentProxies 6 | { 7 | [TestClass] 8 | public class Model67_DifferentProxies_Jet : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model67_DifferentProxies/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model67_DifferentProxies 7 | { 8 | [Table("People67")] 9 | public class Person 10 | { 11 | public Person() 12 | { 13 | Children = new List(); 14 | } 15 | 16 | public int Id { get; set; } 17 | [MaxLength(50)] 18 | public string Name { get; set; } 19 | 20 | public virtual Info Info { get; set; } 21 | 22 | [ForeignKey("Children")] 23 | public int? Person_Id { get; set; } 24 | 25 | public virtual ICollection Children { get; set; } 26 | } 27 | 28 | [Table("Infoes67")] 29 | public class Info 30 | { 31 | public int Id { get; set; } 32 | [MaxLength(50)] 33 | public string Description { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model68_sbyte/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model68_sbyte 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context() 10 | { } 11 | 12 | 13 | public Context(DbConnection connection) 14 | : base(connection, true) 15 | { } 16 | 17 | public DbSet Infos { get; set; } 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model68_sbyte/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model68_sbyte 6 | { 7 | //[TestClass] 8 | public class Model68_SByte_Jet : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model68_sbyte/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model68_sbyte 6 | { 7 | 8 | [Table("Infoes68")] 9 | public class Info 10 | { 11 | public int Id { get; set; } 12 | [MaxLength(50)] 13 | public string Description { get; set; } 14 | 15 | public sbyte Sbyte { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model68_sbyte/SqlCeTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model68_sbyte 6 | { 7 | //[TestClass] 8 | public class Model68_SByte_SqlCe : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetSqlCeConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model68_sbyte/SqlServerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model68_sbyte 6 | { 7 | //[TestClass] 8 | public class Model68_SByte_SqlServer : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetSqlServerConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model68_sbyte/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Common; 4 | using System.Data.Entity; 5 | using System.Linq; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | 8 | namespace JetEntityFrameworkProvider.Test.Model68_sbyte 9 | { 10 | public abstract class Test 11 | { 12 | protected abstract DbConnection GetConnection(); 13 | 14 | [TestMethod] 15 | public void Run() 16 | { 17 | using (var context = new Context(GetConnection())) 18 | { 19 | context.Infos.Add(new Info() {Sbyte = 12}); 20 | context.SaveChanges(); 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model69_PrivateBackingField/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model69_PrivateBackingField 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context() 10 | { } 11 | 12 | 13 | public Context(DbConnection connection) 14 | : base(connection, true) 15 | { } 16 | 17 | public DbSet Infos { get; set; } 18 | 19 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 20 | { 21 | modelBuilder.Configurations.Add(new Info.InfoMap()); 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model69_PrivateBackingField/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model69_PrivateBackingField 6 | { 7 | [TestClass] 8 | public class Model69_PrivateBackingField_Jet : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model69_PrivateBackingField/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model69_PrivateBackingField 6 | { 7 | public abstract class Test 8 | { 9 | protected abstract DbConnection GetConnection(); 10 | 11 | [TestMethod] 12 | public void Run() 13 | { 14 | using (var context = new Context(GetConnection())) 15 | { 16 | context.Infos.Add(new Info() {SByte = 12}); 17 | context.SaveChanges(); 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model70_InMemoryObjectPartialUpdate/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model70_InMemoryObjectPartialUpdate 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context() 10 | { } 11 | 12 | 13 | public Context(DbConnection connection) 14 | : base(connection, true) 15 | { } 16 | 17 | public DbSet Items { get; set; } 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model70_InMemoryObjectPartialUpdate/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model70_InMemoryObjectPartialUpdate 6 | { 7 | [TestClass] 8 | public class Model70_InMemoryObjectPartialUpdate_Jet : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model70_InMemoryObjectPartialUpdate/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model70_InMemoryObjectPartialUpdate 6 | { 7 | 8 | [Table("Item70")] 9 | public class Item 10 | { 11 | public int Id { get; set; } 12 | [MaxLength(50)] 13 | public string ColumnA { get; set; } 14 | [MaxLength(50)] 15 | public string ColumnB { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model71_MasterDetail/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model71_MasterDetail 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context() 10 | { } 11 | 12 | 13 | public Context(DbConnection connection) 14 | : base(connection, true) 15 | { } 16 | 17 | public DbSet Masters { get; set; } 18 | public DbSet Details { get; set; } 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model71_MasterDetail/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model71_MasterDetail 6 | { 7 | [TestClass] 8 | public class Model71_MasterDetail : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model72_ComplexTypeWNavyProp/Context.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.Entity; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model72_ComplexTypeWNavyProp 5 | { 6 | public class TestContext : DbContext 7 | { 8 | public TestContext(DbConnection connection) : base(connection, true) { } 9 | 10 | public DbSet Friends { get; set; } 11 | public DbSet Cities { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model72_ComplexTypeWNavyProp/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model72_ComplexTypeWNavyProp 6 | { 7 | [TestClass] 8 | public class Model72_ComplexTypeWNavyProp : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model72_ComplexTypeWNavyProp/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model72_ComplexTypeWNavyProp 5 | { 6 | 7 | 8 | [Table("Friend72")] 9 | public class Friend 10 | { 11 | public Friend() 12 | {Address = new FullAddress();} 13 | 14 | public int Id { get; set; } 15 | public string Name { get; set; } 16 | 17 | public FullAddress Address { get; set; } 18 | } 19 | 20 | 21 | [Table("City72")] 22 | public class City 23 | { 24 | public int Id { get; set; } 25 | public string Cap { get; set; } 26 | public string Name { get; set; } 27 | } 28 | 29 | [ComplexType] 30 | public class FullAddress 31 | { 32 | public string Street { get; set; } 33 | public City City { get; set; } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model73_Guid_issue20/Car.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model73_Guid_issue20 5 | { 6 | [Table("CarWGuid_73")] 7 | public class Car 8 | { 9 | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] 10 | public Guid Id { get; set; } 11 | public string Name { get; set; } 12 | 13 | public Guid OtherGuid { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model73_Guid_issue20/CarsContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model73_Guid_issue20 6 | { 7 | public class CarsContext : DbContext 8 | { 9 | public CarsContext(DbConnection connection) 10 | : base(connection, false) 11 | {} 12 | 13 | // For migration test 14 | public CarsContext() 15 | { } 16 | 17 | public DbSet Cars { get; set; } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model73_Guid_issue20/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model73_Guid_issue20 6 | { 7 | [TestClass] 8 | public class Model73GuidJetTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model74_Decimal_issue27/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model74_Decimal_issue27 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context() 10 | { } 11 | 12 | 13 | public Context(DbConnection connection) 14 | : base(connection, true) 15 | { } 16 | 17 | public DbSet Infos { get; set; } 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model74_Decimal_issue27/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model74_Decimal_issue27 6 | { 7 | [TestClass] 8 | public class Model74_Decimal_Jet : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model74_Decimal_issue27/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model74_Decimal_issue27 5 | { 6 | 7 | [Table("Infoes74")] 8 | public class Info 9 | { 10 | public int Id { get; set; } 11 | 12 | public decimal Number { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model74_Decimal_issue27/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model74_Decimal_issue27 7 | { 8 | public abstract class Test 9 | { 10 | protected abstract DbConnection GetConnection(); 11 | 12 | [TestMethod] 13 | public void Run() 14 | { 15 | using (var context = new Context(GetConnection())) 16 | { 17 | context.Infos.Add(new Info() {Number = 12.43m}); 18 | context.SaveChanges(); 19 | } 20 | 21 | 22 | 23 | 24 | using (var context = new Context(GetConnection())) 25 | { 26 | Console.WriteLine(context.Infos.Sum(_ => _.Number)); 27 | } 28 | 29 | 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model75_Include_issue28/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model75_Include_issue28 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context() 10 | { } 11 | 12 | 13 | public Context(DbConnection connection) 14 | : base(connection, true) 15 | { } 16 | 17 | public DbSet ReferredClasses { get; set; } 18 | public DbSet ReferringClass1s { get; set; } 19 | public DbSet ReferringClass2s { get; set; } 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model75_Include_issue28/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model75_Include_issue28 6 | { 7 | [TestClass] 8 | public class Model75_Include_Jet : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model76_Contains/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model76_Contains 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context() 10 | { } 11 | 12 | 13 | public Context(DbConnection connection) 14 | : base(connection, true) 15 | { } 16 | 17 | public DbSet Records { get; set; } 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model76_Contains/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model76_Contains 6 | { 7 | [TestClass] 8 | public class Model76_Contains_Jet : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model76_Contains/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model76_Contains 6 | { 7 | [Table("Record76")] 8 | public class Record 9 | { 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model77_RepoModel/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model77_RepoModel 6 | { 7 | public class ApplicationDbContext : DbContext 8 | { 9 | public ApplicationDbContext(DbConnection dbConnection) 10 | : base(dbConnection, true) { } 11 | 12 | public DbSet Items { get; set; } 13 | 14 | public static ApplicationDbContext Create(DbConnection dbConnection) 15 | { 16 | return new ApplicationDbContext(dbConnection); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model77_RepoModel/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model77_RepoModel 6 | { 7 | [TestClass] 8 | public class Model77_RepoPatternTest : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model77_RepoModel/Repository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | 4 | namespace JetEntityFrameworkProvider.Test.Model77_RepoModel 5 | { 6 | class Repository 7 | { 8 | private DbConnection _dbConnection; 9 | 10 | private EfGenericRepository _itemRepository; 11 | 12 | public Repository(DbConnection dbConnection) 13 | { 14 | _dbConnection = dbConnection; 15 | } 16 | 17 | public EfGenericRepository ItemRepository 18 | { 19 | get 20 | { 21 | if (_itemRepository == null) 22 | _itemRepository = new EfGenericRepository(ApplicationDbContext.Create(_dbConnection)); 23 | return _itemRepository; 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model78_SimpleSample/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model78_SimpleSample 6 | { 7 | [TestClass] 8 | public class Model78_SimpleSample_Jet : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model78_SimpleSample/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | 6 | namespace JetEntityFrameworkProvider.Test.Model78_SimpleSample 7 | { 8 | [Table("User78")] 9 | public class User 10 | { 11 | [Key] 12 | public int Id { get; set; } 13 | public virtual ICollection Contacts { get; set; } 14 | public virtual User MyPreferredUser { get; set; } 15 | } 16 | 17 | [Table("Contact78")] 18 | public class Contact 19 | { 20 | [Key] 21 | public int Id { get; set; } 22 | public virtual User User { get; set; } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model78_SimpleSample/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model78_SimpleSample 6 | { 7 | public abstract class Test 8 | { 9 | protected abstract DbConnection GetConnection(); 10 | 11 | [TestMethod] 12 | public void Run() 13 | { 14 | 15 | using (var context= new Context(GetConnection())) 16 | { 17 | context.Contacts.Add(new Contact()); 18 | context.SaveChanges(); 19 | } 20 | 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model79_Like/Context.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using System.Data.Entity; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model79_Like 6 | { 7 | public class Context : DbContext 8 | { 9 | public Context() 10 | { } 11 | 12 | 13 | public Context(DbConnection connection) 14 | : base(connection, true) 15 | { } 16 | 17 | public DbSet Users { get; set; } 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model79_Like/JetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Common; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model79_Like 6 | { 7 | [TestClass] 8 | public class Model79_Like : Test 9 | { 10 | protected override DbConnection GetConnection() 11 | { 12 | return Helpers.GetJetConnection(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Model79_Like/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace JetEntityFrameworkProvider.Test.Model79_Like 6 | { 7 | [Table("User80")] 8 | public class User 9 | { 10 | [Key] 11 | public int Id { get; set; } 12 | 13 | [MaxLength(50)] 14 | public string Description { get; set; } 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("JetEntityFrameworkProvider.Test")] 4 | [assembly: AssemblyDescription("")] 5 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Test/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Utilities/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace JetEntityFrameworkProvider.Utilities 8 | { 9 | class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | //JetProviderLinqFunctionStubsCodeGen.Start(null); 14 | SchemaDefinitionTablesSerializer.Start(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Utilities/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("JetEntityFrameworkProvider.Utilities")] 4 | [assembly: AssemblyDescription("")] 5 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.Utilities/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | SUGGESTION -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/Documentation/DbFirstImplementation.txt: -------------------------------------------------------------------------------- 1 | The implementation needs DDEX provider 2 | http://msdn.microsoft.com/en-us/library/bb163624.aspx 3 | http://sourceforge.net/projects/firebirdddexproviderforvs2012/?source=directory -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/Documentation/JetSQL.txt: -------------------------------------------------------------------------------- 1 | Readings 2 | 3 | Fundamental Microsoft Jet SQL for Access 2000 4 | DDL 5 | DML 6 | SQL 7 | http://msdn.microsoft.com/en-us/library/aa140011(v=office.10).aspx 8 | 9 | Intermediate Microsoft Jet SQL for Access 2000 10 | Summary 11 | DDL 12 | DML 13 | Like syntax and escaping like 14 | http://msdn.microsoft.com/en-us/library/aa140015%28office.10%29.aspx 15 | 16 | 17 | Advanced Microsoft Jet SQL for Access 2000 18 | Summary 19 | Stored procedures (available only if connected to SQL?) 20 | Security 21 | Advanced DML 22 | http://msdn.microsoft.com/en-us/library/aa139977(v=office.10).aspx 23 | 24 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/JetConnectionFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Entity.Infrastructure; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace JetEntityFrameworkProvider 8 | { 9 | public sealed class JetConnectionFactory : IDbConnectionFactory 10 | { 11 | /// 12 | /// Creates a connection based on the given database name or connection string. 13 | /// 14 | /// The database name or connection string. 15 | /// 16 | /// An initialized DbConnection. 17 | /// 18 | /// 19 | public System.Data.Common.DbConnection CreateConnection(string nameOrConnectionString) 20 | { 21 | #warning Here we should support also names 22 | return new JetConnection(nameOrConnectionString); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/JetDataTypeAlias.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JetEntityFrameworkProvider 7 | { 8 | class JetDataTypeAlias 9 | { 10 | public string Name { get; set; } 11 | public string Alias { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/JetEntityFrameworkProvider.csproj.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/JetStoreSchemaDefinition/Column.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.Entity.Core.Metadata.Edm; 3 | 4 | namespace JetEntityFrameworkProvider.JetStoreSchemaDefinition 5 | { 6 | class Column 7 | { 8 | public string Name { get; set; } 9 | public string Type { get; set; } 10 | public bool Nullable { get; set; } 11 | public int? MaxLength { get; set; } 12 | 13 | public override string ToString() 14 | { 15 | return string.Format("{0} {2}({3}) {1}", Name, Nullable ? "Null" : "NotNull", Type, MaxLength); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/JetStoreSchemaDefinition/ColumnCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace JetEntityFrameworkProvider.JetStoreSchemaDefinition 4 | { 5 | class ColumnCollection : List 6 | { 7 | } 8 | } -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/OleDbColumnFlagEnum.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JetEntityFrameworkProvider 7 | { 8 | [Flags] 9 | enum OleDbColumnFlag 10 | { 11 | None = 0, 12 | IsBookMark = 1, 13 | MayDefer = 2, 14 | Write = 4, 15 | WriteUnknown = 8, 16 | IsFixedLength = 16, 17 | IsNullable = 32, 18 | MayBeNull = 64, 19 | IsLong = 128, 20 | IsRowId = 256, 21 | IsRowVer = 512, 22 | CachedDeferred = 4096 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("JetEntityFrameworkProvider")] 4 | [assembly: AssemblyDescription("Jet (Microsoft Access mdb or accdb files) provider for Entity Framework 6")] 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/Resources/StoreSchemaDefinitionRetrieve_QueryHack1.txt: -------------------------------------------------------------------------------- 1 | SELECT 2 | [#TableColumns].[Ordinal] AS [C1], 3 | [#Tables].[CatalogName] AS [CatalogName], 4 | [#Tables].[SchemaName] AS [SchemaName], 5 | [#Tables].[Name] AS [Name], 6 | [#TableColumns].[Name] AS [C2], 7 | [#TableColumns].[IsNullable] AS [C3], 8 | [#TableColumns].[TypeName] AS [C4], 9 | [#TableColumns].[MaxLength] AS [C5], 10 | [#TableColumns].[Precision] AS [C6], 11 | [#TableColumns].[DateTimePrecision] AS [C7], 12 | [#TableColumns].[Scale] AS [C8], 13 | [#TableColumns].[IsIdentity] AS [C9], 14 | [#TableColumns].[IsStoreGenerated] AS [C10], 15 | [#TableColumns].[IsKEY]AS [C11] 16 | FROM 17 | [#TableColumns] 18 | INNER JOIN 19 | [#Tables] ON 20 | [#TableColumns].ParentId = [#Tables].Id 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/Resources/StoreSchemaDefinitionRetrieve_QueryHack2.txt: -------------------------------------------------------------------------------- 1 | SELECT 2 | [#ViewColumns].[Ordinal] AS [C1], 3 | [#Views].[CatalogName] AS [CatalogName], 4 | [#Views].[SchemaName] AS [SchemaName], 5 | [#Views].[Name] AS [Name], 6 | [#ViewColumns].[Name] AS [C2], 7 | [#ViewColumns].[IsNullable] AS [C3], 8 | [#ViewColumns].[TypeName] AS [C4], 9 | [#ViewColumns].[MaxLength] AS [C5], 10 | [#ViewColumns].[Precision] AS [C6], 11 | [#ViewColumns].[DateTimePrecision] AS [C7], 12 | [#ViewColumns].[Scale] AS [C8], 13 | [#ViewColumns].[IsIdentity] AS [C9], 14 | [#ViewColumns].[IsStoreGenerated] AS [C10], 15 | [#ViewColumns].[IsKEY]AS [C11] 16 | FROM 17 | [#ViewColumns] 18 | INNER JOIN 19 | [#Views] ON 20 | [#ViewColumns].ParentId = [#Views].Id 21 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/SetupInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace JetEntityFrameworkProvider 7 | { 8 | class SetupInfo 9 | { 10 | #warning machine.config 11 | // 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/StringHelpers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.RegularExpressions; 3 | 4 | namespace JetEntityFrameworkProvider 5 | { 6 | static class StringHelpers 7 | { 8 | public static string ReplaceCaseInsensitive(this string s, string oldValue, string newValue) 9 | { 10 | return Regex.Replace(s, oldValue, newValue, RegexOptions.IgnoreCase); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /JetEntityFrameworkProvider/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /NuGet.Packager/App.config.uninstall.xdt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /NuGet.Packager/Compile.config.txt: -------------------------------------------------------------------------------- 1 | ..\build\GlobalAssemblyInfo.cs 2 | 3 | _MakeSetup.bat 4 | 5 | -------------------------------------------------------------------------------- /NuGet.Packager/Compile.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bubibubi/JetEntityFrameworkProvider/ea5edff891d2bf716d248018b669e2c588245267/NuGet.Packager/Compile.exe -------------------------------------------------------------------------------- /NuGet.Packager/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bubibubi/JetEntityFrameworkProvider/ea5edff891d2bf716d248018b669e2c588245267/NuGet.Packager/NuGet.exe -------------------------------------------------------------------------------- /NuGet.Packager/_MakeSetup.bat: -------------------------------------------------------------------------------- 1 | @echo Version = %VERSION% 2 | @echo Build with this version numbers (Ctrl + C to stop build)? 3 | pause 4 | 5 | @Echo trying to create Output dir 6 | mkdir lib 7 | 8 | call _MakeSetup_msbuild.bat 9 | 10 | call _MakeSetup_Pack.bat 11 | 12 | call _MakeSetup_Push.bat 13 | 14 | notepad lib\MakeSetup.log 15 | 16 | -------------------------------------------------------------------------------- /NuGet.Packager/_MakeSetup_Pack.bat: -------------------------------------------------------------------------------- 1 | @echo Deleting all package files >> Output\Makesetup.log 2 | del /q lib\*.nupkg >> lib\Makesetup.log 3 | nuget pack JetEntityFrameworkProvider.nuspec -version %VERSION% -OutputDirectory lib >> lib\Makesetup.log 4 | -------------------------------------------------------------------------------- /NuGet.Packager/_MakeSetup_Push.bat: -------------------------------------------------------------------------------- 1 | @echo Press enter to upload nuget files 2 | @pause 3 | SET PARAMETERS= -Verbosity detail -Source https://www.nuget.org/api/v2/package/ 4 | FOR %%F IN (lib\*.nupkg) DO nuget push %%F %PARAMETERS% >> lib\Makesetup.log -------------------------------------------------------------------------------- /NuGet.Packager/_MakeSetup_msbuild.bat: -------------------------------------------------------------------------------- 1 | @echo ========================================================= > Output\MakeSetup.log 2 | call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat" 3 | msbuild ..\JetEntityFrameworkProvider.sln /p:Configuration=Release /p:Platform="Any CPU" >> lib\MakeSetup.log 4 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | **Some documents** 2 | [Enabling CodeFirst simple migration](Enabling_CodeFirst_simple_migration.md) 3 | [Enabling DB First](Enabling_db_first.md) 4 | [mdb or accdb setup](mdb_or_accdb_setup.md) 5 | 6 | 7 | **Questions** 8 | For question on how to use it please use stackoverflow, tags _access-ef-provider_ and _jet-ef-provider_. 9 | 10 | **Project Description** 11 | Entity Framework 6.x Provider for Microsoft Access files. 12 | 13 | It supports only code first 14 | 15 | 16 | 17 | **NuGet** 18 | Now you can download the library using NuGet. Search for JetEntityFrameworkProvider 19 | 20 | 21 | **Some tutorials** 22 | [Using Entity Framework with JetEntityFrameworkProvider](https://www.youtube.com/watch?v=mI0un8jjqL8) 23 | [WebAPI implemented using Entity Framework with JetEntityFrameworkProvider and IdentityManager](https://youtu.be/VVc__TkiH7Y) 24 | [Entity Framework DbFirst with JetEntityFrameworkProvider](https://youtu.be/XHrpY_nMXrk) 25 | 26 | 27 | --------------------------------------------------------------------------------