You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a grain to use transactions it should be instanciated with a ITransactionalState<TState> facet:
public AccountGrain([TransactionalState("balance","TransactionStore")]ITransactionalState<Balance> balance){this.balance =balance??thrownew ArgumentNullException(nameof(balance));}
It would be great to be able to unit test grain with a transactionnal state facet with the test kit. Right now trying to get a grain with a ITransactionalState<TState> facet like so:
Orleans.Runtime.OrleansException : Attribute mapper Castle.Proxies.IAttributeToFactoryMapper`1Proxy failed to create a factory for grain type AccountGrain
at Orleans.Runtime.ConstructorArgumentFactory.ArgumentFactory.GetFactory[TMetadata](IServiceProvider services, ParameterInfo parameter, IFacetMetadata metadata, Type type) in D:\build\agent\_work\23\s\src\Orleans.Runtime\Facet\ConstructorArgumentFactory.cs:line 90
Here is a naive implementation that fulfil the ITransactionalState interface and enable testing such grains:
This is very similar to #55. We can support constructor injection of ITransactionalState<TState> mock objects by registering our own implementation of IAttributeToFactoryMapper<TransactionalStateAttribute> in the silo's dependency injection container.
@erikljung Not directly. I have a branch that adds the needed support for constructor injection, but I've only applied it to the state facet interfaces/classes.
Since the release of Orleans 2.1.0 grains now support transactions.
For a grain to use transactions it should be instanciated with a
ITransactionalState<TState>
facet:It would be great to be able to unit test grain with a transactionnal state facet with the test kit. Right now trying to get a grain with a
ITransactionalState<TState>
facet like so:Is throwing this exception:
Here is a naive implementation that fulfil the
ITransactionalState
interface and enable testing such grains:Standalone usage example:
This implementation works but something integrated to the test kit would be better.
The text was updated successfully, but these errors were encountered: