Example #1
0
     public void OnAttaching(IAttachingService attachingService, object source, IEventsScope eventsScope)
     {
         if (source is TDbContext dbContext)
         {
             ((IObjectContextAdapter)dbContext).ObjectContext.ObjectMaterialized += (sender, args) =>
             {
                 attachingService.Attach(args.Entity, eventsScope);
             }
         }
         ;
     }
 }
Example #2
0
     public void OnAttaching(IAttachingService attachingService, object source, IEventsScope eventsScope)
     {
         if (source is TDbContext dbContext)
         {
             dbContext.ChangeTracker.Tracked += (sender, args) =>
             {
                 attachingService.Attach(args.Entry.Entity, eventsScope);
             }
         }
         ;
     }
 }
Example #3
0
        public void SetUp()
        {
            _sourceModelsServiceMock   = new Mock <ISourceModelsService>(MockBehavior.Strict);
            _forwardingServiceMock     = new Mock <IForwardingService>(MockBehavior.Strict);
            _attachingInterceptorMock1 = new Mock <IAttachingInterceptor>(MockBehavior.Strict);
            _attachingInterceptorMock2 = new Mock <IAttachingInterceptor>(MockBehavior.Strict);
            _eventsScopeMock           = new Mock <IEventsScope>(MockBehavior.Strict);

            _attachingService = new AttachingService(
                _sourceModelsServiceMock.Object,
                _forwardingServiceMock.Object,
                new[]
            {
                _attachingInterceptorMock1.Object,
                _attachingInterceptorMock2.Object
            }
                );
        }