本文整理汇总了C#中DomainObject类的典型用法代码示例。如果您正苦于以下问题:C# DomainObject类的具体用法?C# DomainObject怎么用?C# DomainObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DomainObject类属于命名空间,在下文中一共展示了DomainObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: delete
public void delete(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Person person = (Person)subject;
SqlCommand command = new SqlCommand(
"DELETE FROM Persons WHERE PersonID = @PersonId AND chTimestamp = @chTimestamp",
connection, transaction);
command.Parameters.Add("@chTimestamp", person.Timestamp.Value);
if(subject.isNull("PersonId"))
{
command.Parameters.Add("@PersonId", DBNull.Value );
}
else
{
command.Parameters.Add("@PersonId", person.PersonId);
}
if(command.ExecuteNonQuery() <= 0)
{
throw new ConcurrencyException();
}
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
开发者ID:eglimi,项目名称:storm,代码行数:33,代码来源:PersonMapper.cs
示例2: delete
public void delete(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Employee employee = (Employee)subject;
SqlCommand command = new SqlCommand(
"DELETE FROM Employees WHERE EmployeeID = @EmployeeId AND VersionId = @VersionId",
connection, transaction);
command.Parameters.Add("@VersionId", employee.Timestamp.Value);
if(subject.isNull("EmployeeId"))
{
command.Parameters.Add("@EmployeeId", DBNull.Value );
}
else
{
command.Parameters.Add("@EmployeeId", employee.EmployeeId);
}
if(command.ExecuteNonQuery() <= 0)
{
throw new ConcurrencyException();
}
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
开发者ID:eglimi,项目名称:storm,代码行数:33,代码来源:EmployeeMapper.cs
示例3: WithCustomizedTagNameAndIdentityProperty
public void WithCustomizedTagNameAndIdentityProperty()
{
var id = string.Empty;
using (var store = NewDocumentStore())
{
store.Conventions.AllowQueriesOnId = true;
var defaultFindIdentityProperty = store.Conventions.FindIdentityProperty;
store.Conventions.FindIdentityProperty = property =>
typeof(IEntity).IsAssignableFrom(property.DeclaringType)
? property.Name == "Id2"
: defaultFindIdentityProperty(property);
store.Conventions.FindTypeTagName = type =>
typeof (IDomainObject).IsAssignableFrom(type)
? "domainobjects"
: DocumentConvention.DefaultTypeTagName(type);
using (var session = store.OpenSession())
{
var domainObject = new DomainObject();
session.Store(domainObject);
var domainObject2 = new DomainObject();
session.Store(domainObject2);
session.SaveChanges();
id = domainObject.Id2;
}
var matchingDomainObjects = store.OpenSession().Query<IDomainObject>().Where(_ => _.Id2 == id).ToList();
Assert.Equal(matchingDomainObjects.Count, 1);
}
}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:32,代码来源:JohanNilsson.cs
示例4: deepCopy
protected override void deepCopy(DomainObject domainObject)
{
base.deepCopy(domainObject);
File file = (File)domainObject;
relFileNamePath = file.relFileNamePath;
}
开发者ID:stankela,项目名称:gimnastika,代码行数:7,代码来源:File.cs
示例5: delete
public void delete(DomainObject subject, SqlConnection connection, SqlTransaction transaction)
{
try
{
Territory territory = (Territory)subject;
SqlCommand command = new SqlCommand(
"DELETE FROM Territories WHERE TerritoryID = @TerritoryId AND VersionId = @VersionId",
connection, transaction);
command.Parameters.Add("@VersionId", territory.Timestamp.Value);
if(subject.isNull("TerritoryId"))
{
command.Parameters.Add("@TerritoryId", DBNull.Value );
}
else
{
command.Parameters.Add("@TerritoryId", territory.TerritoryId);
}
if(command.ExecuteNonQuery() <= 0)
{
throw new ConcurrencyException();
}
}
catch(SqlException sqle)
{
throw new ApplicationException(sqle.Message);
}
catch(Exception e)
{
throw new ApplicationException(e.Message);
}
}
开发者ID:eglimi,项目名称:storm,代码行数:33,代码来源:TerritoryMapper.cs
示例6: SetInfoFieldFromObject
public override void SetInfoFieldFromObject(DomainObject pobj, DomainObjectInfo info, IPersistenceContext pctx)
{
Entity entity = (Entity)GetClassFieldValue(pobj);
if (entity != null && pctx.IsProxyLoaded(entity))
{
SetInfoFieldValue(info, _entityConversion.GetInfoFromObject(entity, pctx));
}
}
开发者ID:nhannd,项目名称:Xian,代码行数:8,代码来源:EntityFieldExchange.cs
示例7: unregisterDomainObject
public void unregisterDomainObject(DomainObject domainObject)
{
Hashtable typeMap = (Hashtable)m_typeMaps[domainObject.GetType().BaseType];
if(typeMap == null)
Debug.Assert(false);
Debug.Assert(typeMap.Contains(domainObject.Id));
typeMap.Remove(domainObject.Id);
}
开发者ID:eglimi,项目名称:storm,代码行数:8,代码来源:IdentityMap.cs
示例8: RegisterDirty
public void RegisterDirty(DomainObject obj)
{
if (!(this.newObjects.Contains(obj) || this.dirtyObjects.Contains(obj)))
{
this.dirtyObjects.Add(obj);
this.OnChanged();
}
}
开发者ID:vanloc0301,项目名称:mychongchong,代码行数:8,代码来源:DAOObjects.cs
示例9: IsPersistent
public static bool IsPersistent(DomainObject entity)
{
var keyAttributedProps =
entity.GetType()
.GetProperties()
.FirstOrDefault(p => p.GetCustomAttributes(typeof (KeyAttribute), true).Length == 1);
return (keyAttributedProps != null) && !keyAttributedProps.GetValue(entity, null).ToString().Equals("0");
}
开发者ID:rodmjay,项目名称:ScaffR-Generated,代码行数:8,代码来源:UnitOfWork.cs
示例10: Remove
public void Remove(DomainObject item)
{
if(item == Person.None) return;
if (_domainObjects.Contains(item) == false) return; // Already exists
IList bindingList = _bindingLists[item.GetType()];
bindingList.Remove(item);
_domainObjects.Remove(item);
}
开发者ID:LayCraft,项目名称:comp_157,代码行数:10,代码来源:MovieRepository.cs
示例11: Persist
public void Persist(DomainObject<Guid, DomainEvent> entity)
{
foreach (var @event in entity.GetEvents())
{
this.events.Add(@event);
Console.WriteLine("Saved event {0} to the store.", @event);
}
entity.AcceptEvents();
}
开发者ID:netfx,项目名称:extensions,代码行数:10,代码来源:Program.cs
示例12: Validate
public override bool Validate(DomainObject domainObject)
{
try
{
return GetPropertyValue(domainObject).ToString().Length > 0;
}
catch
{
return false;
}
}
开发者ID:dzstoever,项目名称:ZenFacades,代码行数:11,代码来源:ValidateRequired.cs
示例13: SetObjectFieldFromInfo
public override void SetObjectFieldFromInfo(DomainObject pobj, DomainObjectInfo info, IPersistenceContext pctx)
{
EntityInfo entityInfo = (EntityInfo)GetInfoFieldValue(info);
if (entityInfo != null && entityInfo.GetEntityRef() != null)
{
// don't copy any information from the referenced EntityInfo
// only take its reference
Entity entity = pctx.Load(entityInfo.GetEntityRef(), EntityLoadFlags.Proxy); // proxy, no version check!
SetClassFieldValue(pobj, entity);
}
}
开发者ID:nhannd,项目名称:Xian,代码行数:11,代码来源:EntityFieldExchange.cs
示例14: GetAll
public List<Comment> GetAll(DomainObject<int> target)
{
return DbManager
.ExecuteList(
Query("projects_comments")
.Select(columns)
.Where("target_uniq_id", target.UniqID))
.ConvertAll(r => ToComment(r))
.OrderBy(c => c.CreateOn)
.ToList();
}
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:11,代码来源:CommentDao.cs
示例15: registerDomainObject
public void registerDomainObject(DomainObject domainObject)
{
Type type = domainObject.GetType().BaseType;
Hashtable typeMap = (Hashtable)m_typeMaps[type];
if(typeMap == null)
{
typeMap = new Hashtable();
m_typeMaps[type] = typeMap;
}
Debug.Assert(typeMap.Contains(domainObject) == false);
typeMap.Add(domainObject.Id, domainObject);
}
开发者ID:eglimi,项目名称:storm,代码行数:12,代码来源:IdentityMap.cs
示例16: checkBusinessRulesOnAdd
protected override void checkBusinessRulesOnAdd(DomainObject entity)
{
PraviloOceneVezbe pravilo = (PraviloOceneVezbe)entity;
Notification notification = new Notification();
PraviloOceneVezbeDAO praviloOceneVezbeDAO = DAOFactoryFactory.DAOFactory.GetPraviloOceneVezbeDAO();
if (praviloOceneVezbeDAO.postojiPravilo(pravilo.Naziv))
{
notification.RegisterMessage("Naziv", "Pravilo sa datim nazivom vec postoji.");
throw new BusinessException(notification);
}
}
开发者ID:stankela,项目名称:gimnastika,代码行数:12,代码来源:PraviloForm.cs
示例17: checkBusinessRulesOnAdd
protected override void checkBusinessRulesOnAdd(DomainObject entity)
{
Gimnasticar g = (Gimnasticar)entity;
Notification notification = new Notification();
GimnasticarDAO gimnasticarDAO = DAOFactoryFactory.DAOFactory.GetGimnasticarDAO();
if (gimnasticarDAO.postojiGimnasticar(g.Ime, g.Prezime))
{
notification.RegisterMessage("Ime", "Gimnasticar sa datim imenom i prezimenom vec postoji.");
throw new BusinessException(notification);
}
}
开发者ID:stankela,项目名称:gimnastika,代码行数:12,代码来源:GimnasticarForm.cs
示例18: Validate
public override bool Validate(DomainObject domainObject)
{
try
{
int id = int.Parse(GetPropertyValue(domainObject).ToString());
return id >= 0;
}
catch
{
return false;
}
}
开发者ID:dzstoever,项目名称:ZenFacades,代码行数:12,代码来源:ValidateId.cs
示例19: GetLast
public Comment GetLast(DomainObject<Int32> target)
{
return DbManager
.ExecuteList(
Query("projects_comments")
.Select(columns)
.Where("target_uniq_id", target.UniqID)
.Where("inactive", false)
.OrderBy("create_on", false)
.SetMaxResults(1))
.ConvertAll(r => ToComment(r))
.SingleOrDefault();
}
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:13,代码来源:CommentDao.cs
示例20: checkBusinessRulesOnUpdate
protected override void checkBusinessRulesOnUpdate(DomainObject entity)
{
PraviloOceneVezbe pravilo = (PraviloOceneVezbe)entity;
Notification notification = new Notification();
PraviloOceneVezbeDAO praviloOceneVezbeDAO = DAOFactoryFactory.DAOFactory.GetPraviloOceneVezbeDAO();
bool nazivChanged = (pravilo.Naziv.ToUpper() != oldNaziv.ToUpper()) ? true : false;
if (nazivChanged && praviloOceneVezbeDAO.postojiPravilo(pravilo.Naziv))
{
notification.RegisterMessage("Naziv", "Pravilo sa datim nazivom vec postoji.");
throw new BusinessException(notification);
}
}
开发者ID:stankela,项目名称:gimnastika,代码行数:13,代码来源:PraviloForm.cs
注:本文中的DomainObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论