public void Does_not_throw_when_non_virtual_indexer_not_mapped()
        {
            using var context = new ChangeContext <ChangeNonVirtualIndexerNotUsed>();

            Assert.DoesNotContain(
                context.Model.FindEntityType(typeof(ChangeNonVirtualIndexerNotUsed)).GetProperties(), e => e.IsIndexerProperty());
        }
示例#2
0
 public void Sets_default_change_tracking_strategy()
 {
     using var context = new ChangeContext <ChangeValueEntity>();
     Assert.Equal(
         ChangeTrackingStrategy.ChangingAndChangedNotifications,
         context.Model.GetChangeTrackingStrategy());
 }
 public void Throws_if_non_virtual_indexer_property()
 {
     using var context = new ChangeContext <ChangeNonVirtualIndexer>(entityBuilderAction: b => b.IndexerProperty <int>("Snoopy"));
     Assert.Equal(
         ProxiesStrings.NonVirtualIndexerProperty(nameof(ChangeNonVirtualIndexer)),
         Assert.Throws <InvalidOperationException>(() => context.Model).Message);
 }
        public void Raises_changing_event_before_change(bool useLazyLoading)
        {
            using var context = new ChangeContext <ChangeValueEntity>(useLazyLoading: useLazyLoading);
            var proxy = context.CreateProxy <ChangeValueEntity>();

            proxy.Value = 5;
            context.Add(proxy);
            context.SaveChanges();

            var eventRaised = false;

            ((INotifyPropertyChanging)proxy).PropertyChanging += (s, e) =>
            {
                eventRaised = true;

                Assert.Equal(proxy, s);

                Assert.Equal(
                    nameof(ChangeValueEntity.Value),
                    e.PropertyName);

                Assert.Equal(
                    5,
                    ((ChangeValueEntity)s).Value);
            };

            proxy.Value = 10;
            Assert.True(eventRaised);
        }
示例#5
0
 public ChangeEventArgs(ChangeType type, ChangeContext context, int index, object additionalInfo = null)
 {
     Change  = type;
     Context = context;
     Index   = index;
     AdditionalInformation = additionalInfo;
 }
 public void Throws_if_non_virtual_navigation()
 {
     using var context = new ChangeContext <ChangeNonVirtualNavEntity>();
     Assert.Equal(
         ProxiesStrings.NonVirtualProperty(nameof(ChangeNonVirtualNavEntity.SelfRef), nameof(ChangeNonVirtualNavEntity)),
         Assert.Throws <InvalidOperationException>(
             () => context.Model).Message);
 }
 public void Throws_if_sealed_class()
 {
     using var context = new ChangeContext <ChangeSealedEntity>();
     Assert.Equal(
         ProxiesStrings.ItsASeal(nameof(ChangeSealedEntity)),
         Assert.Throws <InvalidOperationException>(
             () => context.Model).Message);
 }
示例#8
0
        public void Default_change_tracking_strategy_doesnt_overwrite_entity_strategy()
        {
            using var context = new ChangeContext <ChangeValueEntity>(
                      entityBuilderAction: b =>
            {
                b.HasChangeTrackingStrategy(ChangeTrackingStrategy.Snapshot);
            });

            var entityType = context.Model.FindEntityType(typeof(ChangeValueEntity));

            Assert.Equal(
                ChangeTrackingStrategy.Snapshot,
                entityType.GetChangeTrackingStrategy());
        }
        public void Raises_changing_event_when_equal_and_check_equality_false(bool useLazyLoading)
        {
            using var context = new ChangeContext <ChangeValueEntity>(useLazyLoading: useLazyLoading, checkEquality: false);
            var proxy = context.CreateProxy <ChangeValueEntity>();

            proxy.Value = 10;
            context.Add(proxy);
            context.SaveChanges();

            var eventRaised = false;

            ((INotifyPropertyChanging)proxy).PropertyChanging += (s, e) =>
            {
                eventRaised = true;
            };

            proxy.Value = 10;
            Assert.True(eventRaised);
        }
示例#10
0
 public UsersController(ChangeContext context, ILogger <UsersController> logger)
 {
     _context = context;
     _logger  = logger;
 }
示例#11
0
 public UserService(ChangeContext context)
 {
     _context = context;
 }
示例#12
0
 public NewsController(ChangeContext context, ILogger <NewsController> logger)
 {
     _context = context;
     _logger  = logger;
 }
示例#13
0
 public OrdersDetailsController(ChangeContext context)
 {
     _context = context;
 }
示例#14
0
 public CategoriesController(ChangeContext context)
 {
     _context = context;
 }
示例#15
0
 /// <summary>
 /// Override this method to be notified when the UI detects a change.
 /// </summary>
 /// <param name="context">Context object allowing to retrieve information about the change.</param>
 protected internal virtual void OnContentChanged(ChangeContext context)
 {
 }
示例#16
0
 public void Change(ChangeType type, ChangeContext context, int index, object additionalInfo = null)
 {
     OnChange?.Invoke(this, new ChangeEventArgs(type, context, index, additionalInfo));
 }
示例#17
0
 public ChangeService(ChangeContext context)
 {
     _context = context;
 }
示例#18
0
 public AppraisesController(ChangeContext context)
 {
     _context = context;
 }
示例#19
0
 public ContextChanger(ChangeContext changeContext, ProvideContextSource provideContextSource)
 {
     _changeContext = changeContext;
     ContextSource  = provideContextSource;
 }
示例#20
0
 public CarsController(ChangeContext context)
 {
     _context = context;
 }
示例#21
0
 public HomeController(ILogger <HomeController> logger, ChangeContext context, IWebHostEnvironment hostingEnvironment)
 {
     _logger             = logger;
     _context            = context;
     _hostingEnvironment = hostingEnvironment;
 }
示例#22
0
 public DeliveriesController(ChangeContext context)
 {
     _context = context;
 }
示例#23
0
 static Config()
 {
     PublishCtx = createPublishDomainContext();
     ChangeCtx  = createChangeContext();
 }
示例#24
0
 public ChangeController(ChangeContext context, Change changeService, IConfiguration configuration)
 {
     _context       = context;
     _changeService = changeService;
     _config        = configuration;
 }
示例#25
0
 public ProductsController(ChangeContext context, ILogger <ProductsController> logger)
 {
     _context = context; //数据库上下文
     _logger  = logger;  //日志
 }
示例#26
0
 public PhotosController(ChangeContext context)
 {
     _context = context;
 }
示例#27
0
 public FavoritesController(ChangeContext context)
 {
     _context = context;
 }
示例#28
0
 public LoginController(ChangeContext context, ILogger <LoginController> logger)
 {
     _context = context;
     _logger  = logger;
 }