Base solution for your next web application
Open Closed

nosql DB support #3998


User avatar
0
mdonogma created

what other DB's are supported with ef.core now being used


16 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    ABP has an experimental MongoDB implementation: https://github.com/aspnetboilerplate/aspnetboilerplate/tree/dev/src/Abp.MongoDB

    Other NoSQL suggestions in ABP issues:

    Other relevant links:

  • User Avatar
    0
    mdonogma created

    Looking for something production ready as experimental won't get approved for deployments. If Ed core supports other dbs what's the issue with running it via entity framework core directly to cosmosdb? Using document db API

    <cite>aaron: </cite> ABP has an experimental MongoDB implementation: https://github.com/aspnetboilerplate/aspnetboilerplate/tree/dev/src/Abp.MongoDB

    Other NoSQL suggestions in ABP issues:

    Other relevant links:

  • User Avatar
    0
    aaron created
    Support Team

    If you read my link on EF Core Database Providers, you would know that EF Core doesn't support NoSQL databases. It is also unlikely for AspNet Zero to go huge into NoSQL.

    See this link for Azure Cosmos DB: https://docs.microsoft.com/en-us/azure/cosmos-db/documentdb-dotnetcore-get-started

  • User Avatar
    0
    vladsd created

    Here is a framework which maps EF Core to Mongo DB. <a class="postlink" href="https://github.com/crhairr/EntityFrameworkCore.MongoDb">https://github.com/crhairr/EntityFrameworkCore.MongoDb</a>

    My assumption it can be added as is, and then we should be able to configure asp.net zero database to use mongodb.

    Please advise?

  • User Avatar
    0
    alper created
    Support Team

    hi

    apart from technical issues;

    In the Microsoft / .NET microservices - Architecture book, it says this;

    When you use NoSQL databases for your infrastructure data tier, you typically do not use an ORM like Entity Framework Core. Instead you use the API provided by the NoSQL engine, such as Azure Cosmos DB, MongoDB, Cassandra, RavenDB, CouchDB, or Azure Storage Tables.

  • User Avatar
    0
    vladsd created

    We plan to give it a try to that EF to Mongo mapping.

    Not sure I would believe everything microsoft says.

  • User Avatar
    0
    jollyticket created

    I try to map asp.net zero with [https://github.com/crhairr/EntityFrameworkCore.MongoDb]), with the following error:

    System.InvalidOperationException HResult=0x80131509 Message=La raccolta è stata modificata. L'operazione di enumerazione potrebbe non essere eseguita. Source=mscorlib StackTrace: at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List1.Enumerator.MoveNextRare() at System.Collections.Generic.List1.Enumerator.MoveNext() at MongoDB.Bson.Serialization.Conventions.ConventionRunner.Apply(BsonClassMap classMap) at MongoDB.Bson.Serialization.BsonClassMap.AutoMapClass() at MongoDB.Bson.Serialization.BsonClassMap.LookupClassMap(Type classType) at Blueshift.EntityFrameworkCore.MongoDB.Storage.MongoDbTypeMapper.<>c__DisplayClass1_0.<IsTypeMapped>b__0(Type type) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at Blueshift.EntityFrameworkCore.MongoDB.Storage.MongoDbTypeMapper.IsTypeMapped(Type clrType) at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.PropertyDiscoveryConvention.IsCandidatePrimitiveProperty(PropertyInfo propertyInfo) at System.Linq.Enumerable.WhereArrayIterator1.MoveNext() at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.PropertyDiscoveryConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder) at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.PropertyDiscoveryConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, EntityType oldBaseType) at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ImmediateConventionScope.OnBaseEntityTypeChanged(InternalEntityTypeBuilder entityTypeBuilder, EntityType previousBaseType) at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.RunVisitor.VisitOnBaseEntityTypeChanged(OnBaseEntityTypeChangedNode node) at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.OnBaseEntityTypeChangedNode.Accept(ConventionVisitor visitor) at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionVisitor.Visit(ConventionNode node) at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionVisitor.VisitConventionScope(ConventionScope node) at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionBatch.Run() at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionBatch.Dispose() at Microsoft.EntityFrameworkCore.Metadata.Internal.InternalEntityTypeBuilder.HasBaseType(EntityType baseEntityType, ConfigurationSource configurationSource) at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.BaseTypeDiscoveryConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder) at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ImmediateConventionScope.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder) at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder) at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.AddEntityType(EntityType entityType) at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.AddEntityType(Type type, ConfigurationSource configurationSource) at Microsoft.EntityFrameworkCore.Metadata.Internal.InternalModelBuilder.Entity(TypeIdentity type, ConfigurationSource configurationSource) at Microsoft.EntityFrameworkCore.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource) at Microsoft.EntityFrameworkCore.ModelBuilder.Entity(Type type) at Microsoft.EntityFrameworkCore.Infrastructure.ModelCustomizer.FindSets(ModelBuilder modelBuilder, DbContext context) at Microsoft.EntityFrameworkCore.Infrastructure.ModelCustomizer.Customize(ModelBuilder modelBuilder, DbContext context) at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator) at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.<>c__DisplayClass5_0.<GetModel>b__0(Object k) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator) at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel() at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model() at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.<TryAddCoreServices>b__7_1(IServiceProvider p) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies() at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider() at Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider>.get_Instance() at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider>.get_Instance() at Microsoft.EntityFrameworkCore.Internal.InternalAccessorExtensions.GetService[TService](IInfrastructure1 accessor) at Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure1 accessor) at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.get_ExecutionStrategyFactory() at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.CreateExecutionStrategy() at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.BeginTransaction(DatabaseFacade databaseFacade, IsolationLevel isolationLevel) at Abp.EntityFrameworkCore.Uow.DbContextEfCoreTransactionStrategy.CreateDbContext[TDbContext](String connectionString, IDbContextResolver dbContextResolver) at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.GetOrCreateDbContext[TDbContext](Nullable1 multiTenancySide) at Abp.EntityFrameworkCore.Uow.UnitOfWorkExtensions.GetDbContext[TDbContext](IActiveUnitOfWork unitOfWork, Nullable1 multiTenancySide) at Voiago.Migrations.Seed.SeedHelper.WithDbContext[TDbContext](IIocResolver iocResolver, Action1 contextAction) in S:\Progetti\SLT\Voiago\Dev\branch-mongodb\aspnet-core\src\Voiago.EntityFrameworkCore\Migrations\Seed\SeedHelper.cs:line 40 at Voiago.Migrations.Seed.SeedHelper.SeedHostDb(IIocResolver iocResolver) in S:\Progetti\SLT\Voiago\Dev\branch-mongodb\aspnet-core\src\Voiago.EntityFrameworkCore\Migrations\Seed\SeedHelper.cs:line 18 at Voiago.EntityFrameworkCore.VoiagoEntityFrameworkCoreModule.PostInitialize() in S:\Progetti\SLT\Voiago\Dev\branch-mongodb\aspnet-core\src\Voiago.EntityFrameworkCore\EntityFrameworkCore\VoiagoEntityFrameworkCoreModule.cs:line 58 at Abp.Modules.AbpModuleManager.<>c.<StartModules>b__15_2(AbpModuleInfo module) at System.Collections.Generic.List1.ForEach(Action1 action) at Abp.Modules.AbpModuleManager.StartModules() at Abp.AbpBootstrapper.Initialize()

    any suggestions on where to investigate?

  • User Avatar
    0
    alper created
    Support Team

    The exception stack shows that the last error line in AspNet Zero layer is -> DbContextEfCoreTransactionStrategy.CreateDbContext(...)

    So what I see here is, this provider doesn't support transactions. You can try out disabling transactions on application level. See the below config;

    [DependsOn(
    	typeof(AbpZeroCoreEntityFrameworkCoreModule),
    	typeof(AbpZeroTemplateCoreModule),
    	typeof(AbpZeroCoreIdentityServerEntityFrameworkCoreModule)
    	)]
    public class AbpZeroTemplateEntityFrameworkCoreModule : AbpModule
    {
    	public override void PreInitialize()
    	{
    	   // ....
    	   // add this line to disable transactions
    		Configuration.UnitOfWork.IsTransactional = false;
    	   // ....
    	}
    	
    	//........
    }
    

    good luck ;)

  • User Avatar
    0
    andmattia created

    In my solution I've created a new module to use MongoDb with BsonDocument.

    You need to pay attention to UOW and you need to create a wrapper to Repository Method. In the wrapper you need to use Query (native MongoDb).

    I my experince is quite simple use MongoDb to serialize large object or entity where Json/mongodb(nosql) is the best solution and MSSQL (via EF for classic entity like user, bank, customer). This mix give you the best off 2 soultion

  • User Avatar
    0
    jollyticket created

    <cite>alper: </cite> The exception stack shows that the last error line in AspNet Zero layer is -> DbContextEfCoreTransactionStrategy.CreateDbContext(...)

    So what I see here is, this provider doesn't support transactions. You can try out disabling transactions on application level. See the below config;

    [DependsOn(
      typeof(AbpZeroCoreEntityFrameworkCoreModule),
      typeof(AbpZeroTemplateCoreModule),
      typeof(AbpZeroCoreIdentityServerEntityFrameworkCoreModule)
      )]
    public class AbpZeroTemplateEntityFrameworkCoreModule : AbpModule
    {
      public override void PreInitialize()
      {
         // ....
         // add this line to disable transactions
      	Configuration.UnitOfWork.IsTransactional = false;
         // ....
      }
      
      //........
    }
    

    good luck ;)

    It's mandatory for my project the use of mongo-db. :cry:

    Can I change the datastore at repository level? Have you a document about what I need to implement? I know that without EF I'll lose entity history and transactions.

  • User Avatar
    0
    BobIngham created

    @jollyticket - If you want all of your data in Mongodb why not cut into EntityHistory functionality and serialize the results using the .net Mongodb driver? That way all of your data will be in Mongodb and your relational stuff will be where it should be, in a relational database? Just a suggestion but it may give you a different direction of thinking because I think you will be pulling your hair out trying to get a system out with an unsupported solution????

  • User Avatar
    0
    ismcagdas created
    Support Team

    @jollyticket, @BobIngham is right, AspNet Zero doesn't support MongoDB. So if you try to use AspNet Zero with MongoDb (I'm not sure if it is possible at all), you will loose quite amount of time I think.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Also EntityFramework doesn't support MongoDB officially, so I think it is not good to build a product on a library which is not officially supported.

  • User Avatar
    0
    jollyticket created

    Probably the best way to close this post is to write that <ins>aspnetzero does NOT support no-sql databases</ins> like mongodb, rather than giving directions or suggestions on impossible implementations.

    The fact remains that this is a splendid framework for everything else

  • User Avatar
    0
    BobIngham created

    Jeepers, @ jollyticket - aspnetzero is PERFECT for no-sql databases. Serialisation of EntityHistory gives you the initial document and every change thereafter gives an additional document. You could even throw the the serialised result on to a command bus to give you CQRS. If the result of your project has to be a Mongodb database (and I can understand why that may be) and the start point has to be aspnetzero then this is the way to go. Leave the relational database where it is, it is serving the purpose it is designed for. Don't re-invent the wheel.

    ... and don't over-engineer.

    Good luck on that deadline, I hope it all works out for you!

  • User Avatar
    0
    ismcagdas created
    Support Team

    @jollyticket,

    aspnetzero does NOT support no-sql databases officially for storing it's built-in entities/tables would be better :). Because you can store your new entities in MongoDB.