I need to secure some transactions cause I been having some duplicated entries.
the logic goes like
I have understood that what I need is some database locks, also that with isolation level serialize each transaction starts to read when the prev transaction finishes writing.
using (
var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions
{IsolationLevel = IsolationLevel.Serializable}, TransactionScopeAsyncFlowOption.Enabled))
{
...
scope.Complete();
}
did'n work, still producing duplicated entry's
Configuration.UnitOfWork.IsolationLevel = IsolationLevel.Serializable;
at the preinitializer on the Core module. Also did not work
this, among many non useful hacks that I found on internet
please, any help will be very appreciated. Thanks in advance
I have a IDomainService implementation like this:
INTERFACE
public interface IAuthorizationManager : IDomainService
{
Task<List<AuthorizationRole>> GetAutorizationRolesByRequisitionConsumptionCenterStore(
RequisitionConsumptionCenterStore requisitionConsumptionCenterStore, Status status);
IMPLEMENTATION
public class AuthorizationManager : DomainService, IAuthorizationManager
METHOD DECLARATION
public async Task<List<AuthorizationRole>> GetAutorizationRolesByRequisitionConsumptionCenterStore(
RequisitionConsumptionCenterStore requisitionConsumptionCenterStore, Status
On the other hand, I have an Event handler
public class RequisitionConsumptionCenterStoreNotifier :
IEventHandler<EntityCreatedEventData<RequisitionConsumptionCenterStoreStatus>>, ITransientDependency
Every time the the event (RequisitionConsumptionCenterStoreNotifier.NotifyOnRelease) is fired i got an "the operation cannot be completed because the DbContext has been disposed". I already tried marking the manager method as UnitOfWork, Marking the Handler method as UnitOfWork, managing unit of work manually with
"using (var uow = _unitOfWorkManager.Begin())"
and declaring manager method as virtual.
I really do not know what to do, I think that is an unit of work problem. Im open to any suggestions. Thanks in advance.
it works thanks a lot
I'm trying to make a seed with some notification subscription but when I add NotificationSubscription entity to dbContext, like this:
public virtual IDbSet<NotificationSubscription> NotificationSubscription { get; set; }
this is what I got
EntityType 'NotificationSubscription' has no key defined. Define the key for this EntityType. NotificationSubscription: EntityType: EntitySet 'NotificationSubscription' is based on type 'NotificationSubscription' that has no keys defined.
Is there a way to do this?
thanks
I'm trying to make a seed with some notification subscription but when I add NotificationSubscription entity to dbContext, like this:
public virtual IDbSet<NotificationSubscription> NotificationSubscription { get; set; }
this is what I got
EntityType 'NotificationSubscription' has no key defined. Define the key for this EntityType. NotificationSubscription: EntityType: EntitySet 'NotificationSubscription' is based on type 'NotificationSubscription' that has no keys defined.
Is there a way to do this?
thanks