public virtual IRepository Create()
{
this.EnsureInitialized();
try
{
if (!string.IsNullOrEmpty(this.connectionString))
{
return (IRepository)this.repositoryConstructor.Invoke(new object[] { this.connectionString });
}
else
{
return (IRepository)this.repositoryConstructor.Invoke(null);
}
}
catch (TargetInvocationException ex)
{
if (this.repositoryTypeName.StartsWith("BlueCollar.SQLiteRepository", StringComparison.Ordinal)
&& ex.InnerException != null)
{
if (typeof(FileLoadException) == ex.InnerException.GetType()
&& ex.InnerException.Message.Contains("Mixed mode assembly"))
{
throw new InvalidOperationException("The System.Data.SQLite.dll being referenced is built against an un-supported version of the .NET runtime. Please reference a System.Data.SQLite.dll built against the runtime (.NET 3.5/4.0) and architecture (x86/x64) that matches your application.", ex);
}
else if (typeof(FileNotFoundException) == ex.InnerException.GetType())
{
throw new InvalidOperationException("You are trying to use BlueCollar.SQLiteRepository for storage, but System.Data.SQLite.dll could not be found. Please add a reference to the System.Data.SQLite.dll mixed mode assembly built against the runtime (.NET 3.5/4.0) and architecture (x86/x64) that matches your application.", ex);
}
}
throw;
}
}