Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
66a64c9
Merge pull request #3 from loresoft/master
djechelon Jul 9, 2015
23b5bf1
Merge pull request #4 from loresoft/master
djechelon Jul 9, 2015
5e8bb2a
Mysql detector
Jul 10, 2015
92ab257
Update xunit
Jul 10, 2015
b8b42a5
Draft of MySql tests
Jul 10, 2015
4da2cad
Escape in runner, not in mapping provider
Jul 13, 2015
40fcf7d
Merge from upstream
Jul 13, 2015
dc3ef71
Escape in runner, not in mapping provider
Jul 13, 2015
1c85f62
Merge from master
Jul 13, 2015
b26a91a
Merge pull request #5 from loresoft/master
djechelon Jul 15, 2015
f4c3327
Xunit
Jul 15, 2015
2395570
Merge branch 'master' of https://github.com/OpenCST/EntityFramework.E…
Jul 15, 2015
3f12a41
Escape in runner, not in mapping provider
Jul 13, 2015
6a3aa25
Advice from [email protected]
Jul 16, 2015
5cf8f6b
Merge
Jul 16, 2015
98916ea
Update tests with new specifications of Mapping
Jul 16, 2015
579b386
appveyor mysql
Jul 16, 2015
ca5dd80
Merge pull request #6 from loresoft/master
djechelon Jul 16, 2015
0441fe1
Net40 test updated
Jul 17, 2015
6c29dcc
Merge branch 'mysqlrunner' of https://github.com/OpenCST/EntityFramew…
Jul 17, 2015
47c67d1
Net40 test updated
Jul 17, 2015
22385b1
Implement batch runner for postgresql.
raol Dec 9, 2015
8601958
Remove detecting outside transaction.
raol Mar 4, 2016
f43974e
Put schema and table name in quotes
raol Mar 4, 2016
3bc120f
Merge pull request #7 from raol/pgsqlrunner
djechelon May 24, 2016
dd0b823
Merge mysqlbatchrunner branch
May 24, 2016
fae16bf
Solution configuration update
Dec 20, 2016
4a8ce60
Merge pull request #1 from OpenCST/master
Feb 22, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Mysql detector
  • Loading branch information
antonio.anzivino committed Jul 10, 2015
commit 5e8bb2a99cdb4acdf163aae447747cda0a09907f
32 changes: 24 additions & 8 deletions Source/EntityFramework.Extended/Extensions/BatchExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
using System.Threading.Tasks;
using EntityFramework.Batch;
using EntityFramework.Mapping;
using System.Data.Entity.Core.EntityClient;
using System.Data.Common;
using System.Data.SqlClient;

namespace EntityFramework.Extensions
{
Expand Down Expand Up @@ -102,7 +105,7 @@ public static int Delete<TEntity>(this IQueryable<TEntity> source)
if (entityMap == null)
throw new ArgumentException("Could not load the entity mapping information for the query ObjectSet.", "source");

var runner = ResolveRunner();
var runner = ResolveRunner(objectContext);
return runner.Delete(objectContext, entityMap, sourceQuery);
}

Expand Down Expand Up @@ -173,7 +176,7 @@ public static Task<int> DeleteAsync<TEntity>(this IQueryable<TEntity> source)
if (entityMap == null)
throw new ArgumentException("Could not load the entity mapping information for the query ObjectSet.", "source");

var runner = ResolveRunner();
var runner = ResolveRunner(objectContext);
return runner.DeleteAsync(objectContext, entityMap, sourceQuery);
}

Expand Down Expand Up @@ -222,7 +225,7 @@ public static int Update<TEntity>(
if (objectQuery == null)
throw new ArgumentException("The query must be of type ObjectQuery or DbQuery.", "query");

var runner = ResolveRunner();
var runner = ResolveRunner(objectContext);
return runner.Update(objectContext, entityMap, objectQuery, updateExpression);
}

Expand Down Expand Up @@ -306,7 +309,7 @@ public static int Update<TEntity>(
if (entityMap == null)
throw new ArgumentException("Could not load the entity mapping information for the source.", "source");

var runner = ResolveRunner();
var runner = ResolveRunner(objectContext);
return runner.Update(objectContext, entityMap, sourceQuery, updateExpression);
}

Expand Down Expand Up @@ -391,17 +394,30 @@ public static Task<int> UpdateAsync<TEntity>(
if (entityMap == null)
throw new ArgumentException("Could not load the entity mapping information for the source.", "source");

var runner = ResolveRunner();
var runner = ResolveRunner(objectContext);
return runner.UpdateAsync(objectContext, entityMap, sourceQuery, updateExpression);
}

#endif

private static IBatchRunner ResolveRunner()
private static IBatchRunner ResolveRunner(ObjectContext context)
{
var provider = Locator.Current.Resolve<IBatchRunner>();
DbConnection theConnection = (context.Connection as EntityConnection).StoreConnection;

IBatchRunner provider = null;

if (theConnection is SqlConnection)
provider = new SqlServerBatchRunner();
else if (theConnection.GetType().FullName == "MySql.Data.MySqlClient.MySqlConnection")
provider = new MySqlBatchRunner();

if (provider == null)
throw new InvalidOperationException("Could not resolve the IBatchRunner. Make sure IBatchRunner is registered in the Locator.Current container.");
{
var ex = new InvalidOperationException("Could not resolve the IBatchRunner. Current database is not supported");
ex.Data["DbConnection"] = theConnection;

throw ex;
}

return provider;
}
Expand Down