GithubHelp home page GithubHelp logo

orleanscontrib / orleans.providers.entityframework Goto Github PK

View Code? Open in Web Editor NEW
50.0 16.0 15.0 126 KB

An Entity Framework Core implementation of Orleans Grain Storage. More providers to come later.

License: MIT License

C# 100.00%
orleans orleans-storage-provider entity-framework-core

orleans.providers.entityframework's People

Contributors

alirezajm avatar amirraptor avatar ronnygunawan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

orleans.providers.entityframework's Issues

[Question] Support for actors that are stored as collections

Hello. First things first: Thank you for your time and work, it's an excellent project!

Could you please clarify if it's currently possible to store a collection, for example, Grain<List<T>>? I'm looking for a way to implement an actor that would serve as a read-only cache for the whole (already existing) database table, not the single row.

I probably can achieve my goal by injecting the Entity context into the actor directly, but it would be cool to be able to depend on 'ReadStateAsync()` functionality. Btw if it's impossible now, but you think it's a feature that would be beneficial to the project, could you please provide some guidance on how to better implement it?

Dead Project - Take Over

As it appears the original contributors are no longer maintaining the project how do we go about taking over?

While EF Core would not be first choice as a storage provider there are still some use cases where can be beneficial.

Errors when works with EfCore 3.1

v0.14.6
When I set PreCompileReadQuery=true
Errors:

System.InvalidOperationException: An exception was thrown while attempting to evaluate the LINQ query parameter expression 'Invoke(value(Orleans.Providers.EntityFramework.Conventions.GrainStorageConvention+<>c__DisplayClass8_5`3[Backet.Api.Infrastructure.BacketDbContext,Backet.Api.Grains.BacketGrain,Backet.Api.Domain.AggregatesModel.BacketAggregate.Backet]).CS$<>8__locals5.options.DbSetAccessor, value(Backet.Api.Infrastructure.BacketDbContext)).SingleOrDefault(value(Orleans.Providers.EntityFramework.Conventions.GrainStorageConvention+<>c__DisplayClass8_5`3[Backet.Api.Infrastructure.BacketDbContext,Backet.Api.Grains.BacketGrain,Backet.Api.Domain.AggregatesModel.BacketAggregate.Backet]).predicate)'.
       ---> System.Collections.Generic.KeyNotFoundException: The given key '__grainKey' was not present in the dictionary.
         at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
         at Microsoft.EntityFrameworkCore.Query.Internal.ParameterValueBasedSelectExpressionOptimizer.ParameterNullabilityBasedSqlExpressionOptimizingExpressionVisitor.VisitSqlBinaryExpression(SqlBinaryExpression sqlBinaryExpression)
         at Microsoft.EntityFrameworkCore.Query.Internal.SqlExpressionOptimizingExpressionVisitor.VisitExtension(Expression extensionExpression)
         at Microsoft.EntityFrameworkCore.Query.Internal.ParameterValueBasedSelectExpressionOptimizer.ParameterNullabilityBasedSqlExpressionOptimizingExpressionVisitor.VisitExtension(Expression extensionExpression)
         at System.Linq.Expressions.Expression.Accept(ExpressionVisitor visitor)
         at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
         at Microsoft.EntityFrameworkCore.Query.SqlExpressions.SelectExpression.VisitChildren(ExpressionVisitor visitor)
         at System.Linq.Expressions.ExpressionVisitor.VisitExtension(Expression node)
         at Microsoft.EntityFrameworkCore.Query.Internal.SqlExpressionOptimizingExpressionVisitor.VisitSelectExpression(SelectExpression selectExpression)
         at Microsoft.EntityFrameworkCore.Query.Internal.SqlExpressionOptimizingExpressionVisitor.VisitExtension(Expression extensionExpression)
         at Microsoft.EntityFrameworkCore.Query.Internal.ParameterValueBasedSelectExpressionOptimizer.ParameterNullabilityBasedSqlExpressionOptimizingExpressionVisitor.VisitExtension(Expression extensionExpression)
         at System.Linq.Expressions.Expression.Accept(ExpressionVisitor visitor)
         at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
         at Microsoft.EntityFrameworkCore.Query.Internal.ParameterValueBasedSelectExpressionOptimizer.Optimize(SelectExpression selectExpression, IReadOnlyDictionary`2 parametersValues)
         at Microsoft.EntityFrameworkCore.Query.Internal.RelationalCommandCache.GetRelationalCommand(IReadOnlyDictionary`2 parameters)
         at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.InitializeReader(DbContext _, Boolean result)
         at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
         at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext()
         at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
         at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
         at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
         at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source, Expression`1 predicate)
         at lambda_method(Closure )
         at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.GetValue(Expression expression, String& parameterName)
         --- End of inner exception stack trace ---
         at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.GetValue(Expression expression, String& parameterName)
         at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Evaluate(Expression expression, Boolean generateParameter)
         at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression)
         at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.ExtractParameters(Expression expression)
         at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExtractParameters(Expression query, IParameterValues parameterValues, IDiagnosticsLogger`1 logger, Boolean parameterize, Boolean generateContextAccessors)
         at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CreateCompiledAsyncQuery[TResult](Expression query)
         at Microsoft.EntityFrameworkCore.Query.Internal.CompiledAsyncTaskQuery`2.CreateCompiledQuery(IQueryCompiler queryCompiler, Expression expression)
         at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryBase`2.<>c__DisplayClass6_0.<EnsureExecutor>b__0(TContext c, LambdaExpression q)
         at Microsoft.EntityFrameworkCore.Internal.NonCapturingLazyInitializer.EnsureInitialized[TParam1,TParam2,TValue](TValue& target, TParam1 param1, TParam2 param2, Func`3 valueFactory)
         at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryBase`2.EnsureExecutor(TContext context)
         at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryBase`2.ExecuteCore(TContext context, CancellationToken cancellationToken, Object[] parameters)
         at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryBase`2.ExecuteCore(TContext context, Object[] parameters)
         at Microsoft.EntityFrameworkCore.Query.Internal.CompiledAsyncTaskQuery`2.ExecuteAsync[TParam1](TContext context, TParam1 param1)
         at Orleans.Providers.EntityFramework.Conventions.GrainStorageConvention.<>c__DisplayClass8_5`3.<CreatePreCompiledDefaultReadStateFunc>b__9(TContext context, IAddressable grainRef) in d:\Source\Repos\Pole\src\Pole.Orleans.Provider.EntityframeworkCore\Conventions\GrainStorageConvention.cs:line 284

When I set PreCompileReadQuery=false
Errors:

The LINQ expression 'DbSet<Backet>
          .Where(b => Invoke(__options_KeyExtSelector_0, b[Backet])
           == __keyExt_1)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information

System.InvalidOperationException: No value provided for required parameter '__grainKey'.

I've been running into this issue for a while now and can't seem to find a solution. I believe it's coming from the CreateKeyPredicate and CreatePreCompiledDefaultReadStateFunc methods inside of the GrainStorageConvention. Do you have any idea why this is happening?

For some background info, I have an ASP.NET Core 3 project that was using EF Core 3 to talk to a SQL DB. I'm now trying to use Orleans as middleware between the API and DB to help the project scale. I upgraded my models to match the default grain storage convention and applied the migrations to the DB but now I'm running into the above error. Is there something I'm missing with the DB structure?

Issue with GrainStorageContext since Orleans 3.0.0-rc1

Something wrong with GrainStorageContext since Orleans 3.0.0-rc1 release. GrainStorageContext.IsConfigured in GrainStorage.WriteStateAsync always return false.
It seems the problem releated to AsyncLocal values in GrainStorageContext.

With Orleans 3.0.0-beta1 all seems OK.

Granular updates on state

It would be nice to be able to update a single field when calling WriteStateAsync. Could be done using an async context.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.