本文整理汇总了C#中DomainContext类的典型用法代码示例。如果您正苦于以下问题:C# DomainContext类的具体用法?C# DomainContext怎么用?C# DomainContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DomainContext类属于命名空间,在下文中一共展示了DomainContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewInvocationContextIsConfiguredCorrectly
public void NewInvocationContextIsConfiguredCorrectly()
{
var configuration = new DomainConfiguration();
configuration.EnsureCommitted();
var domainContext = new DomainContext(configuration);
var context = new InvocationContext(domainContext);
Assert.Same(domainContext, context.DomainContext);
}
示例2: ReinitializeDatabase
private static IUnitOfWork ReinitializeDatabase(DomainContext dbContext)
{
// force to single_user so that we can drop the database in order to prevent this error: "database is currently in use ..."
dbContext.Database.ExecuteSqlCommand(string.Format("ALTER DATABASE {0} SET SINGLE_USER WITH ROLLBACK IMMEDIATE", Fixture.DatabaseName));
new DatabaseInitializer().InitializeDatabase(dbContext);
return new UnitOfWork(dbContext);
}
示例3: WhenHandlerRegistered_ThenCanProcessEntity
public void WhenHandlerRegistered_ThenCanProcessEntity()
{
var id = Guid.NewGuid();
var product = new Product(id, "DevStore");
var context = default(IDomainContext);
var eventStream = new EventStream();
IDomainEventStore store = new ConsoleEventStore();
// Keep the handlers so they are not GC'ed.
var handlers = new object[]
{
new ConsoleHandler(eventStream),
new SendMailHandler(eventStream),
};
context = new DomainContext(eventStream, store);
context.Save(product);
// Save changes and cause publication of pending events
// in the newly created domain object.
context.SaveChanges();
Console.WriteLine();
// Here some command might pull the product from the
// context, and invoke a domain method.
var savedProduct = context.Find<Product>(id);
product.Publish(1);
// Saving again causes persistence of the entity state
// as well as publishing the events.
context.SaveChanges();
}
示例4: GetAll
public IEnumerable<Person> GetAll()
{
var context = new DomainContext(this.ConnectionString);
return context.Persons.Include("AssignedSymptoms").Include("FirstPersonPersons");/*.Include("SecondPersonPersons").Include("PersonContacts").Include("AssignedRiskFactors")
.Include("Credentials").Include("PersonGroups").Include("PersonOperations").Include("PersonDiseases").Include("PersonAllergicReactions")
.Include("ConsultationsAsDoctor").Include("ConsultationsAsPatient").Include("PersonHospitalizations");*/
}
示例5: Start
/// <summary>
/// Creates a new DomainContext and starts its processors, using the previously applied configurations.
/// </summary>
/// <returns>A new DomainContext</returns>
public IDomainContext Start()
{
if (this.Configuring != null)
{
this.Configuring(this);
}
var context = new DomainContext(this.EventStore.Value,
new EventBus(this.MessageBus.Value),
new CommandBus(this.MessageBus.Value),
this.Processors.Value,
this.LoggerFactory.Value,
this.Resolver.Value);
if (this.Configured != null)
{
this.Configured(context);
}
this.Configuring = null;
this.Configured = null;
context.StartProcessors();
return context;
}
示例6: GetAll
public IEnumerable<PersonConsultation> GetAll()
{
var context = new DomainContext(this.ConnectionString);
return context.PersonConsultations.Include("Doctor").Include("Patient").Include("ConsultationType").Include("PersonConsultationResearches")
.Include("PersonConsultationLabAnalyzes").Include("PersonConsultationSymptoms").Include("PersonConsultationComplaints")
.Include("PersonConsultationMeasurings").Include("PersonConsultationDiagnosises").Include("AssignedMedicaments").Include("AssignedMeasurings");
}
示例7: Modify
public void Modify(DomainContext context)
{
EntitySet<MockUser> users = context.EntityContainer.GetEntitySet<MockUser>();
if (!users.Contains(this))
{
users.Attach(this);
}
this.RaiseDataMemberChanging("MutableProperty");
this.MutableProperty++;
this.RaiseDataMemberChanged("MutableProperty");
}
示例8: GetEntitiesByQuery
public IEnumerable<HospitalDepartment> GetEntitiesByQuery(Func<HospitalDepartment, bool> query)
{
if (query == null)
{
throw new ArgumentNullException("query");
}
using (var context = new DomainContext(this.ConnectionString))
{
return context.HospitalDepartments.Include("Hospital").Include("PersonHospitalizations").Where(query).ToList();
}
}
示例9: ChangeSentTimeout
public static void ChangeSentTimeout(DomainContext aContext, TimeSpan aSendTimeout)
{
PropertyInfo lChangeFactoryProperty = aContext.DomainClient.GetType().GetProperty("ChannelFactory");
if (lChangeFactoryProperty == null)
{
throw new InvalidOperationException("There is no ChannelFactory property on the DomainClient.");
}
ChannelFactory lFactory = (ChannelFactory)lChangeFactoryProperty.GetValue(aContext.DomainClient, null);
lFactory.Endpoint.Binding.ReceiveTimeout = aSendTimeout;
lFactory.Endpoint.Binding.ReceiveTimeout = aSendTimeout;
}
示例10: GetEntitiesByQuery
public IEnumerable<PersonConsultationLabAnalyze> GetEntitiesByQuery(Func<PersonConsultationLabAnalyze, bool> query)
{
if (query == null)
{
throw new ArgumentNullException("query");
}
using (var context = new DomainContext(this.ConnectionString))
{
return context.PersonConsultationLabAnalyzes.Include("LabAnalyzeType").Include("PersonConsultation").Where(query).ToList();
}
}
示例11: GetEntitiesByQuery
public IEnumerable<AssignedRiskFactor> GetEntitiesByQuery(Func<AssignedRiskFactor, bool> query)
{
if (query == null)
{
throw new ArgumentNullException("query");
}
using (var context = new DomainContext(this.ConnectionString))
{
return context.AssignedRiskFactors.Include("Person").Include("RiskFactor").Where(query).ToList();
}
}
示例12: GetEntitiesByQuery
public IEnumerable<OnceRiskFactorNotification> GetEntitiesByQuery(Func<OnceRiskFactorNotification, bool> query)
{
if (query == null)
{
throw new ArgumentNullException("query");
}
using (var context = new DomainContext(this.ConnectionString))
{
return context.OnceRiskFactorNotifications.Where(query).ToList();
}
}
示例13: GetEntitiesByQuery
public IEnumerable<PersonAllergicReaction> GetEntitiesByQuery(Func<PersonAllergicReaction, bool> query)
{
if (query == null)
{
throw new ArgumentNullException("query");
}
using (var context = new DomainContext(this.ConnectionString))
{
return context.PersonAllergicReactions.Include("Person").Include("AllergicReaction").Where(query).ToList();
}
}
示例14: GetEntitiesByQuery
public IEnumerable<Research> GetEntitiesByQuery(Func<Research, bool> query)
{
if (query == null)
{
throw new ArgumentNullException("query");
}
using (var context = new DomainContext(this.ConnectionString))
{
return context.Researches.Include("PersonConsultationResearches").Where(query).ToList();
}
}
示例15: GetEntitiesByQuery
public IEnumerable<AsignedSymptom> GetEntitiesByQuery(Func<AsignedSymptom, bool> query)
{
if (query == null)
{
throw new ArgumentNullException("query");
}
using (var context = new DomainContext(this.ConnectionString))
{
return context.AsignedSymptoms.Include("Person").Include("Symptom").Where(query);
}
}