orleanscontrib / orleans.providers.entityframework Goto Github PK
View Code? Open in Web Editor NEWAn Entity Framework Core implementation of Orleans Grain Storage. More providers to come later.
License: MIT License
An Entity Framework Core implementation of Orleans Grain Storage. More providers to come later.
License: MIT License
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.
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.
This blocks the storage provider to be set as the default provider.
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?
It would be nice to be able to update a single field when calling WriteStateAsync. Could be done using an async context.
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
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.