Base solution for your next web application

Activities of "epgeroy"

Question

I need to secure some transactions cause I been having some duplicated entries.

the logic goes like

  1. is there some products
  2. get them!
  3. write on database that you got it (in another table) and wait for authorization (another use case)

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.

  1. I used
using (
    var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions
        {IsolationLevel = IsolationLevel.Serializable}, TransactionScopeAsyncFlowOption.Enabled))
        {
            ...
            scope.Complete();
       }

did'n work, still producing duplicated entry's

  1. I tried
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

Showing 1 to 5 of 5 entries