Base solution for your next web application
Open Closed

Seed example datas with DynamicFilters to Oracle #124


User avatar
0
daws created

Hello guys,

I saw that a few people here are using oracle as main DB.

Does anyone have successfuly seeded the abp zero project on their Oracle Db ?

If I do this :

protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.HasDefaultSchema("TEST");
            //base.OnModelCreating(modelBuilder);

My creation& seedare fine. But we miss DynamicFilters And the Web Project says "FilterMustHaveTenant" Not found.

So, we need to include the base.OnModelCreating(modelBuilder);.

When I regenerate the migration file and run update-database -verbose; it creates well tables (not sure that it create annotation stuffs); but the seed does not work. I have

insert into "TEST"."__MigrationHistory"("MigrationId", "ContextKey", "Model", "ProductVersion")
values ('201506040834534_create', 'ModuleZeroSampleProject', model_blob, '6.1.3-40302');
end;
Running Seed method.
System.Data.Entity.Core.EntityCommandCompilationException: An error occurred while preparing the command definition. See the inner exception for details. ---> System.ArgumentException: DbComparisonExpression requires arguments with comparable types.
   at System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder.DbExpressionBuilder.CreateComparison(DbExpressionKind kind, DbExpression left, DbExpression right)
   at System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder.DbExpressionBuilder.Equal(DbExpression left, DbExpression right)
   at EntityFramework.DynamicFilters.DynamicFilterQueryVisitor.BuildFilterExpressionWithDynamicFilters(String entityName, IEnumerable`1 filterList, DbExpressionBinding binding, DbExpression predicate)
   at EntityFramework.DynamicFilters.DynamicFilterQueryVisitor.Visit(DbScanExpression expression)
   at System.Data.Entity.Core.Common.CommandTrees.DbScanExpression.Accept[TResultType](DbExpressionVisitor`1 visitor)
   at System.Data.Entity.Core.Common.CommandTrees.DefaultExpressionVisitor.VisitExpression(DbExpression expression)
   at System.Data.Entity.Core.Common.CommandTrees.DefaultExpressionVisitor.VisitGroupExpressionBinding(DbGroupExpressionBinding binding)
   at System.Data.Entity.Core.Common.CommandTrees.DefaultExpressionVisitor.Visit(DbGroupByExpression expression)
   at System.Data.Entity.Core.Common.CommandTrees.DbGroupByExpression.Accept[TResultType](DbExpressionVisitor`1 visitor)
   at System.Data.Entity.Core.Common.CommandTrees.DefaultExpressionVisitor.VisitExpression(DbExpression expression)
   at System.Data.Entity.Core.Common.CommandTrees.DefaultExpressionVisitor.VisitExpressionBinding(DbExpressionBinding binding)
   at System.Data.Entity.Core.Common.CommandTrees.DefaultExpressionVisitor.VisitExpressionBindingEnterScope(DbExpressionBinding binding)
   at System.Data.Entity.Core.Common.CommandTrees.DefaultExpressionVisitor.Visit(DbProjectExpression expression)
   at System.Data.Entity.Core.Common.CommandTrees.DbProjectExpression.Accept[TResultType](DbExpressionVisitor`1 visitor)
   at EntityFramework.DynamicFilters.DynamicFilterInterceptor.TreeCreated(DbCommandTreeInterceptionContext interceptionContext)
   at System.Data.Entity.Infrastructure.Interception.DbCommandTreeDispatcher.<Created>b__0(IDbCommandTreeInterceptor i, DbCommandTreeInterceptionContext c)
   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TInterceptionContext,TResult](TResult result, TInterceptionContext interceptionContext, Action`2 intercept)
   at System.Data.Entity.Infrastructure.Interception.DbCommandTreeDispatcher.Created(DbCommandTree commandTree, DbInterceptionContext interceptionContext)
   at System.Data.Entity.Core.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree commandTree, DbInterceptionContext interceptionContext)
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, BridgeDataReaderFactory bridgeDataReaderFactory, ColumnMapFactory columnMapFactory)
   --- End of inner exception stack trace ---
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, BridgeDataReaderFactory bridgeDataReaderFactory, ColumnMapFactory columnMapFactory)
   at System.Data.Entity.Core.EntityClient.Internal.EntityProviderServices.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree, DbInterceptionContext interceptionContext)
   at System.Data.Entity.Core.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree commandTree, DbInterceptionContext interceptionContext)
   at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlanFactory.CreateCommandDefinition(ObjectContext context, DbQueryCommandTree tree)
   at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlanFactory.Prepare(ObjectContext context, DbQueryCommandTree tree, Type elementType, MergeOption mergeOption, Boolean streaming, Span span, IEnumerable`1 compiledQueryParameters, AliasGenerator aliasGenerator)
   at System.Data.Entity.Core.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)
   at System.Data.Entity.Core.Objects.ObjectQuery`1.&lt;&gt;c__DisplayClass7.&lt;GetResults&gt;b__6()
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
   at System.Data.Entity.Core.Objects.ObjectQuery`1.&lt;&gt;c__DisplayClass7.&lt;GetResults&gt;b__5()
   at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
   at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
   at System.Data.Entity.Core.Objects.ObjectQuery`1.&lt;System.Collections.Generic.IEnumerable&lt;T&gt;.GetEnumerator>b__0()
   at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.&lt;GetElementFunction&gt;b__3[TResult](IEnumerable`1 sequence)
   at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
   at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
   at System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)
   at System.Linq.Queryable.Count[TSource](IQueryable`1 source)
   at ModuleZeroSampleProject.Migrations.Data.InitialDataBuilder.CreateUserAndRoles(ModuleZeroSampleProjectDbContext context) in c:\ABPZERO\ORACLE\ModuleZeroSampleProject.EntityFramework\Migrations\Data\InitialDataBuilder.cs:line 27
   at ModuleZeroSampleProject.Migrations.Data.InitialDataBuilder.Build(ModuleZeroSampleProjectDbContext context) in c:\ABPZERO\ORACLE\ModuleZeroSampleProject.EntityFramework\Migrations\Data\InitialDataBuilder.cs:line 19
   at ModuleZeroSampleProject.Migrations.Configuration.Seed(ModuleZeroSampleProjectDbContext context) in c:\ABPZERO\ORACLE\ModuleZeroSampleProject.EntityFramework\Migrations\Configuration.cs:line 20
   at System.Data.Entity.Migrations.DbMigrationsConfiguration`1.OnSeed(DbContext context)
   at System.Data.Entity.Migrations.DbMigrator.SeedDatabase()
   at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.SeedDatabase()
   at System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
   at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
   at System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration)
   at System.Data.Entity.Migrations.DbMigrator.&lt;&gt;c__DisplayClassc.&lt;Update&gt;b__b()
   at System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
   at System.Data.Entity.Migrations.Infrastructure.MigratorBase.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
   at System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
   at System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(String targetMigration)
   at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.Run()
   at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
   at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
   at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
   at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force)
   at System.Data.Entity.Migrations.UpdateDatabaseCommand.&lt;&gt;c__DisplayClass2.&lt;.ctor&gt;b__0()
   at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
An error occurred while preparing the command definition. See the inner exception for details.
PM>

even if my .config have

&lt;edmMappings&gt;
        &lt;edmMapping dataType=&quot;number&quot;&gt;
          &lt;add name=&quot;bool&quot; precision=&quot;1&quot;/&gt;
          &lt;add name=&quot;byte&quot; precision=&quot;3&quot;/&gt;
          &lt;add name=&quot;int16&quot; precision=&quot;5&quot;/&gt;
          &lt;add name=&quot;int32&quot; precision=&quot;10&quot;/&gt;
          &lt;add name=&quot;int64&quot; precision=&quot;19&quot;/&gt;
        &lt;/edmMapping&gt;
      &lt;/edmMappings&gt;
    &lt;/version&gt;

Does anyone have an idea or cant get it run successful on their side ?

(I'm not sure if DynamicFilter annotations stuff are compatible with oracle. But I don't need them)

And not; is there a way to get rid of all DynamicFilter & annotation stuff in abp (creation, seed, & use) ?

Thanks all !


4 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    I added an issue related to that: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/508">https://github.com/aspnetboilerplate/as ... issues/508</a> I haven't checked it if properly works for Oracle. You can ask here: <a class="postlink" href="https://github.com/jcachat/EntityFramework.DynamicFilters/issues">https://github.com/jcachat/EntityFramew ... ers/issues</a>

  • User Avatar
    0
    daws created

    Thanks!

    I've created an issue on their github to ask them about oracle; we'll see :)

    <a class="postlink" href="https://github.com/jcachat/EntityFramework.DynamicFilters/issues/40">https://github.com/jcachat/EntityFramew ... /issues/40</a>

  • User Avatar
    0
    daws created

    Jcachat helped us on this one !

    He added the support of Oracle into his nuget. Abp-modulezero fully works now with oracle (EF code first, seed and test website)

    <a class="postlink" href="https://github.com/jcachat/EntityFramework.DynamicFilters/issues/40">https://github.com/jcachat/EntityFramew ... /issues/40</a>

  • User Avatar
    0
    hikalkan created
    Support Team

    That's wonderful! Thanks for information.