Hi!
Is it possible to use effort with MigrateDatabaseToLatestVersion database Initializer?
I have a project which use it with initializer defined like this:
Test Name: GetBook_WithNonExistingId_ReturnsNull
Test FullName: Testy_Jednostkowe.BookRepositoryTests.GetBook_WithNonExistingId_ReturnsNull
Test Source: d:\documents\visual studio 2015\Projects\Testowanie_EF6_Wlaczone_Migracje\Testy_Jednostkowe\BookRepositoryTests.cs : line 28
Test Outcome: Failed
Test Duration: 0:00:04,6449765
Result StackTrace:
w Effort.Internal.DbManagement.DbContainer.get_Internal()
w Effort.Internal.DbManagement.DbContainer.GetTable(String name)
w Effort.Internal.DbCommandTreeTransformation.TransformVisitor.Visit(DbScanExpression expression)
w System.Data.Entity.Core.Common.CommandTrees.DbScanExpression.Accept[TResultType](DbExpressionVisitor
w Effort.Internal.DbCommandTreeTransformation.TransformVisitor.Visit(DbExpression expression)
w Effort.Internal.DbCommandTreeTransformation.TransformVisitor.Visit(DbLimitExpression expression)
w System.Data.Entity.Core.Common.CommandTrees.DbLimitExpression.Accept[TResultType](DbExpressionVisitor
w Effort.Internal.DbCommandTreeTransformation.TransformVisitor.Visit(DbExpression expression)
w Effort.Internal.CommandActions.QueryCommandAction.ExecuteDataReader(ActionContext context)
w Effort.Provider.EffortEntityCommand.ExecuteDbDataReader(CommandBehavior behavior)
w System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
w System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<>c__DisplayClassb.<Reader>b__8()
w System.Data.Entity.Infrastructure.Interception.InternalDispatcher
w System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
w System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
w System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
w System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
--- End of inner exception stack trace ---
w System.Data.Entity.Core.Objects.ObjectQuery
w System.Data.Entity.Core.Objects.ObjectQuery
w System.Data.Entity.Core.Objects.ObjectQuery
w System.Data.Entity.Core.Objects.ObjectQuery
w System.Lazy
w System.Data.Entity.Internal.LazyEnumerator
w System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__2[TResult](IEnumerable
w System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
w System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)
w System.Linq.Queryable.SingleOrDefault[TSource](IQueryable
w Baza.BookRepository.Get(Int32 id) w d:\documents\visual studio 2015\Projects\Testowanie_EF6_Wlaczone_Migracje\Baza\BookRepository.cs:wiersz 16
w Testy_Jednostkowe.BookRepositoryTests.GetBook_WithNonExistingId_ReturnsNull() w d:\documents\visual studio 2015\Projects\Testowanie_EF6_Wlaczone_Migracje\Testy_Jednostkowe\BookRepositoryTests.cs:wiersz 33
Result Message:
Test method Testy_Jednostkowe.BookRepositoryTests.GetBook_WithNonExistingId_ReturnsNull threw exception:
System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> Effort.Exceptions.EffortException: Database has not been initialized.
If using CodeFirst try to add the following line:
context.Database.CreateIfNotExists()
Is it possible to use effort with MigrateDatabaseToLatestVersion database Initializer?
I have a project which use it with initializer defined like this:
static LibraryContext()
{
Database.SetInitializer(new MigrateDatabaseToLatestVersion<LibraryContext, Configuration>());
}
Problem is that effort can't initialize the dabase:Test Name: GetBook_WithNonExistingId_ReturnsNull
Test FullName: Testy_Jednostkowe.BookRepositoryTests.GetBook_WithNonExistingId_ReturnsNull
Test Source: d:\documents\visual studio 2015\Projects\Testowanie_EF6_Wlaczone_Migracje\Testy_Jednostkowe\BookRepositoryTests.cs : line 28
Test Outcome: Failed
Test Duration: 0:00:04,6449765
Result StackTrace:
w Effort.Internal.DbManagement.DbContainer.get_Internal()
w Effort.Internal.DbManagement.DbContainer.GetTable(String name)
w Effort.Internal.DbCommandTreeTransformation.TransformVisitor.Visit(DbScanExpression expression)
w System.Data.Entity.Core.Common.CommandTrees.DbScanExpression.Accept[TResultType](DbExpressionVisitor
1 visitor)
w Effort.Internal.DbCommandTreeTransformation.TransformVisitor.Visit(DbExpression expression)
w Effort.Internal.DbCommandTreeTransformation.TransformVisitor.Visit(DbFilterExpression expression)
w System.Data.Entity.Core.Common.CommandTrees.DbFilterExpression.Accept[TResultType](DbExpressionVisitor
1 visitor)w Effort.Internal.DbCommandTreeTransformation.TransformVisitor.Visit(DbExpression expression)
w Effort.Internal.DbCommandTreeTransformation.TransformVisitor.Visit(DbLimitExpression expression)
w System.Data.Entity.Core.Common.CommandTrees.DbLimitExpression.Accept[TResultType](DbExpressionVisitor
1 visitor)
w Effort.Internal.DbCommandTreeTransformation.TransformVisitor.Visit(DbExpression expression)
w Effort.Internal.DbCommandTreeTransformation.TransformVisitor.Visit(DbProjectExpression expression)
w System.Data.Entity.Core.Common.CommandTrees.DbProjectExpression.Accept[TResultType](DbExpressionVisitor
1 visitor)w Effort.Internal.DbCommandTreeTransformation.TransformVisitor.Visit(DbExpression expression)
w Effort.Internal.CommandActions.QueryCommandAction.ExecuteDataReader(ActionContext context)
w Effort.Provider.EffortEntityCommand.ExecuteDbDataReader(CommandBehavior behavior)
w System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
w System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<>c__DisplayClassb.<Reader>b__8()
w System.Data.Entity.Infrastructure.Interception.InternalDispatcher
1.Dispatch[TInterceptionContext,TResult](Func
1 operation, TInterceptionContext interceptionContext, Action1 executing, Action
1 executed)w System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
w System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
w System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
w System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
--- End of inner exception stack trace ---
w System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
w System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)w System.Data.Entity.Core.Objects.ObjectQuery
1.<>c__DisplayClass3.<GetResults>b__2()
w System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func
1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)w System.Data.Entity.Core.Objects.ObjectQuery
1.<>c__DisplayClass3.<GetResults>b__1()
w System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func
1 operation)w System.Data.Entity.Core.Objects.ObjectQuery
1.GetResults(Nullable
1 forMergeOption)w System.Data.Entity.Core.Objects.ObjectQuery
1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
w System.Lazy
1.CreateValue()w System.Lazy
1.LazyInitValue()
w System.Lazy
1.get_Value()w System.Data.Entity.Internal.LazyEnumerator
1.MoveNext()
w System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable
1 source)w System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__2[TResult](IEnumerable
1 sequence)
w System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable
1 query, Expression queryRoot)w System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
w System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)
w System.Linq.Queryable.SingleOrDefault[TSource](IQueryable
1 source, Expression
1 predicate)w Baza.BookRepository.Get(Int32 id) w d:\documents\visual studio 2015\Projects\Testowanie_EF6_Wlaczone_Migracje\Baza\BookRepository.cs:wiersz 16
w Testy_Jednostkowe.BookRepositoryTests.GetBook_WithNonExistingId_ReturnsNull() w d:\documents\visual studio 2015\Projects\Testowanie_EF6_Wlaczone_Migracje\Testy_Jednostkowe\BookRepositoryTests.cs:wiersz 33
Result Message:
Test method Testy_Jednostkowe.BookRepositoryTests.GetBook_WithNonExistingId_ReturnsNull threw exception:
System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> Effort.Exceptions.EffortException: Database has not been initialized.
If using CodeFirst try to add the following line:
context.Database.CreateIfNotExists()