private void Notify_ContextChanges(SomeDataContext obj) { Dispatcher.Invoke(() => { this.DataContext = obj; }); }
public SomeDataCommandHandler(IEventBus eventBus, SomeDataContext dbContext, ISomeDataWriteRepository someDataWriteRepository, IBusinessUserRepository businessUserRepositoy) { _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext)); _someDataWriteRepository = someDataWriteRepository ?? throw new ArgumentNullException(nameof(someDataWriteRepository)); _businessUserRepositoy = businessUserRepositoy ?? throw new ArgumentNullException(nameof(businessUserRepositoy)); }
public EntityFrameworkUnitOfWork(IConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } _dbContext = EntityFrameworkContextFactory.CreateSomeDataContext(configuration); }
public void Delete(SomeAggregate someData, SomeDataContext dbContext) { var someDataToDelete = dbContext.SomeData.FirstOrDefault(d => d.Id == someData.Id); if (someDataToDelete != null) { dbContext.SomeData.Remove(someDataToDelete); } }
protected override bool AuthorizeCore(HttpContextBase httpContext) { if (base.AuthorizeCore(httpContext)) { var name = httpContext.User.Identity.Name; using (var db = new SomeDataContext()) { var userPoints = db.Users .Where(u => u.UserName == name) .Select(u => u.Points) .SingleOrDefault(); } return(userPoints >= PointsRequired); } return(false); }
public void Save(SomeAggregate someData, SomeDataContext dbContext) { var someDataToUpdate = dbContext.SomeData.FirstOrDefault(d => d.Id == someData.Id); if (someDataToUpdate == null) { return; } someDataToUpdate.Color = someData.Color.Value; someDataToUpdate.CreationDate = someData.CreationDate; someDataToUpdate.FacebookUrl = someData.FacebookUrl.Value; someDataToUpdate.FirstName = someData.FirstName; someDataToUpdate.LastName = someData.LastName; someDataToUpdate.MiddleName = someData.MiddleName; someDataToUpdate.Title = someData.Title; someDataToUpdate.BusinessUserId = someData.BusinessUserId; }
private void ApplineConfigs() { this.Closing += MainWindow_Closing; NotifyContext <SomeDataContext> notify = new NotifyContext <SomeDataContext>(); SomeDataContext context = new SomeDataContext() { FirstName = "Dzmitry", LastName = "Dym" }; this.DataContext = context; notify.Connected += Notify_Connected; notify.Disconnected += Notify_Disconnected; notify.Timeout += Notify_Timeout; notify.Message += Notify_Message; notify.ContextChanges += Notify_ContextChanges; notify.Exception += Notify_Exception; line = LineFactory.Launcher <SomeDataContext>(notify, @"..\..\..\Application\bin\Debug\Application.exe", 3000); }
public WriteRepository(SomeDataContext dataContext) { _dataContext = dataContext ?? throw new ArgumentNullException(nameof(dataContext)); }
public void Create(SomeAggregate someData, SomeDataContext dbContext) { var someDatatoSave = SomeDataMapper.SomeAggregateToPersistanceModel(someData); dbContext.SomeData.Add(someDatatoSave); }
public SomeAggregate Get(Guid someDataId, SomeDataContext dbContext) { return(SomeDataMapper.PersistanceModelToAggregateRoot( dbContext.SomeData.FirstOrDefault(d => d.Id == someDataId))); }
public BusinessUserRepository(SomeDataContext someDataContext) { _someDataContext = someDataContext ?? throw new ArgumentNullException(nameof(someDataContext)); }
public SomeService(string connectionString) { _db = new SomeDataContext(connectionString); }
public SomeService() { _db = new SomeDataContext(ConfigurationManager.ConnectionStrings["SomeSqlServer"].ConnectionString); }
public SomeDataReadRepository(SomeDataContext someDataEntities) { SomeDataEntities = someDataEntities; }
public BusinessUser GetByApplicationUserId(ApplicationUserId id, SomeDataContext dbContext) { return(dbContext.BusinessUsers.FirstOrDefault(u => u.IdentityId == id.Value)); }
public SomeDatasController(SomeDataContext context) { _context = context; }
public SomeDataWriteRepository(SomeDataContext someDataEntities) { SomeDataEntities = someDataEntities; }