private void PersistExistingConfig() { using (var context = new PropertyContext()) { foreach ( var prop in typeof (IExampleTypedConfig).GetProperties(BindingFlags.Instance | BindingFlags.Public)) { var p = context.DomainEntityAttachedProperties.Add(new AttachedProperty { EntityType = typeof (IExampleTypedConfig).FullName, Name = prop.Name, Type = prop.PropertyType.FullName }); context.SaveChanges(); context.DomainEntityAttachedPropertyValuesLong.Add(new AttachedPropertyValueLong { EntityId = EntityId, PropertyId = p.Id, Value = prop.GetValue(_existingConfig).ToString() }); context.SaveChanges(); } } }
public void Then_Db_should_know_mail_property() { using (var context = new PropertyContext()) { var mail = Config.CustomerMail; Assert.NotNull(context.DomainEntityAttachedProperties.Single(p => p.Type == typeof (MailAddress).FullName && p.EntityType == typeof (IExampleTypedConfig).FullName && p.Name == "CustomerMail" )); } }
public void Then_Db_should_know_firstName_property() { using (var context = new PropertyContext()) { var firstName = Config.FirstName; Assert.NotNull(context.DomainEntityAttachedProperties.Single(p => p.Type == typeof (string).FullName && p.EntityType == typeof (IExampleTypedConfig).FullName && p.Name == "FirstName" )); } }