public ITestResultsProvider CreateProvider(int providerId, bool withTracking) { ITestResultsProvider resultsProvider = null; switch (providerId) { case TOOL_DATA_READER: resultsProvider = new OriginalProvider(); break; case TOOL_LINQ_2_SQL: resultsProvider = new Linq2SqlProvider(withTracking); break; case TOOL_LINQ_2_SQL_COMPILED: resultsProvider = new Linq2SqlCompiledProvider(withTracking); break; case TOOL_ENTITY_FRAMEWORK: resultsProvider = new EntityFrameworkProvider(withTracking); break; case TOOL_ENTITY_FRAMEWORK_COMPILED: resultsProvider = new EntityFrameworkCompiledProvider(withTracking); break; case TOOL_ENTITY_FRAMEWORK_ENTITYSQL: resultsProvider = new EntityFrameworkEntitySqlProvider(withTracking); break; } return(resultsProvider); }
static void Main(string[] args) { //http://merle-amber.blogspot.ru/2008/11/net-orm-1.html ITestResultsProvider provider = null; if (args.Length == 0) { return; } bool useTracking = args.Length > 1 && bool.TryParse(args[1], out useTracking) ? useTracking : true; switch (args[0]) { case "ado": provider = new OriginalProvider(); break; case "linq": provider = new Linq2SqlProvider(useTracking); break; case "ef": provider = new EntityFrameworkProvider(useTracking); break; case "ar": provider = null; //new ActiveRecordProvider(); break; default: break; } if (provider == null) { return; } TestInitialization(provider); Console.Out.WriteLine(string.Format("Use tracking: {0}", useTracking.ToString())); DateTime testBegin = DateTime.Now; // TODO: Uncomment necessary test or few of them //RunTest(provider, TestType.Orders); RunTest(provider, TestType.OrdersMultiple); //RunTest(provider, TestType.CustomerProducts); RunTest(provider, TestType.CustomerProductsMultiple); //RunTest(provider, TestType.CustomerProductsComplex); RunTest(provider, TestType.CustomerProductsComplexMultiple); //RunTest(provider, TestType.CustomerProductsMixed); //RunTest(provider, TestType.CustomerModify); TimeSpan passedTime = DateTime.Now - testBegin; Console.Out.WriteLine("Overall spent time: " + passedTime.TotalMilliseconds); //Console.ReadKey(); }
/// <summary> /// This all would normally be done in your IoC container /// </summary> private static void Bootstrap() { var base36 = new Base36IdGenerator( numTimestampCharacters: 12, numServerCharacters: 6, numRandomCharacters: 7, reservedValue: "", delimiter: "-", delimiterPositions: new[] { 20, 15, 10, 5 }); var connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; _provider = new EntityFrameworkProvider(connectionString) { IsEntityType = type => type.IsSubclassOf(typeof(Createable<>)) }; _provider.SetCurrentUser("Funcular\\Paul"); Createable<string>.IdentityFunction = () => base36.NewId(); }
public void Setup() { // This is the stuff you would normally do when configuring your IOC container. this._base36 = new Base36IdGenerator( numTimestampCharacters: 11, numServerCharacters: 4, numRandomCharacters: 5, reservedValue: "", delimiter: "-", delimiterPositions: new[] {15, 10, 5}); var connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; this._provider = new EntityFrameworkProvider(connectionString) { IsEntityType = type => type.IsSubclassOf(typeof (Createable<>)) }; this._provider.SetCurrentUser("Funcular\\Paul"); this._provider.GetDatabase().Log = s => Debug.WriteLine(s); Createable<string>.IdentityFunction = () => this._base36.NewId(); }