using VS2010
1. Create a TestProject
2. Create an EntityFramework model with one entity
3. Create a unit test:
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
var conStr = ConfigurationManager.ConnectionStrings["StorageEntities"].ConnectionString;
doTest(conStr);
}
private static void doTest(string conStr)
{
using (var storage = new StorageEntities(conStr))
{
storage.ExecuteStoreCommand("SELECT * FROM [SystemInfo]");
}
}
}
4. add app.config:
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite"/>
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"/>
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="StorageEntities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SQLite;provider connection string="data source=_full_path_to_database_file_;BinaryGUID=False"" providerName="System.Data.EntityClient"/>
</connectionStrings>
5. Create a new connection in Server Explorer, create a database-file and create table inside it via Query window:
CREATE TABLE IF NOT EXISTS [SystemInfo] (
[MajorVersion] integer NOT NULL ,
[MinorVersion] integer NOT NULL
, PRIMARY KEY ([MajorVersion], [MinorVersion]));
6. Run the unittest. It'll pass
7. Run the unittest one more time. It'll fail with the following exception:
Test method SQLiteAppDomainUnloadException.UnitTest1.TestMethod1 threw exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'System.Data.SQLite.SQLiteFactory' threw an exception. ---> System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.
Aaaaa!
On 1.0.66.0 evetything works fine. Please fix ASAP. Thanks
<hr /><i>mistachkin added on 2011-09-30 09:00:18 UTC:</i><br />
Already fixed by check-in [1d955a6031]. Soon to be released as version 1.0.75.0.
|