本文整理汇总了C#中IEntity.set方法的典型用法代码示例。如果您正苦于以下问题:C# IEntity.set方法的具体用法?C# IEntity.set怎么用?C# IEntity.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntity
的用法示例。
在下文中一共展示了IEntity.set方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setEntityByCheckNull
/// <summary>
/// 1.5新增,针对已删除用户应用 null object 模式
/// </summary>
/// <param name="obj"></param>
/// <param name="ep"></param>
/// <param name="propertyValue"></param>
public static void setEntityByCheckNull( IEntity obj, EntityPropertyInfo ep, Object propertyValue, int realUserId )
{
if (propertyValue == null && rft.IsInterface( ep.Type, typeof( IUser ) )) {
IEntity user = getNullUser( realUserId );
obj.set( ep.Name, user );
}
else {
obj.set( ep.Name, propertyValue );
}
}
示例2: SetParameters
internal static void SetParameters( IDbCommand cmd, String action, IEntity obj, EntityInfo entityInfo )
{
for (int i = 0; i < entityInfo.SavedPropertyList.Count; i++) {
EntityPropertyInfo info = entityInfo.SavedPropertyList[i];
if (isContinue( action, info, entityInfo )) continue;
Object paramVal = obj.get( info.Name );
if (paramVal == null && info.DefaultAttribute != null) {
paramVal = info.DefaultAttribute.Value;
}
if (paramVal == null) {
setDefaultValue( cmd, info, entityInfo );
}
else if (info.Type.IsSubclassOf( typeof( IEntity ) ) || MappingClass.Instance.ClassList.Contains( info.Type.FullName )) {
setEntityId( cmd, info, paramVal );
}
else {
paramVal = DataFactory.SetParameter( cmd, info.ColumnName, paramVal );
obj.set( info.Name, paramVal );
}
}
}
示例3: Validate
public static Result Validate(IEntity target, String action)
{
EntityInfo entityInfo = Entity.GetInfo(target);
Result result = new Result();
try
{
foreach (EntityPropertyInfo info in entityInfo.SavedPropertyList)
{
if (!info.SaveToDB) continue;
if (checkLength(info))
{
Object val = target.get(info.Name);
if (val != null)
target.set(info.Name, strUtil.SubString(val.ToString(), info.SaveAttribute.Length));
}
foreach (ValidationAttribute vattr in info.ValidationAttributes)
{
vattr.Validate(action, target, info.Name, result);
}
}
}
catch (Exception ex)
{
LogManager.GetLogger(typeof(Validator)).Error(ex.Message);
}
return result;
}
示例4: setEntityPropertyValueById
private static void setEntityPropertyValueById( IEntity obj, ObjectInfo state, EntityPropertyInfo property, long pid ) {
if (!property.IsAbstractEntity) {
IEntity objValue = Entity.New( property.Type.FullName );
objValue.Id = pid;
// state
//objValue.state = new ObjectInfo( property.Type ).Copy( state );
IEntity objCache = ObjectPool.FindOne( property.Type, objValue.Id );
if (objCache != null) {
objValue = objCache;
}
obj.set( property.Name, objValue );
}
}
示例5: setEntityByCheckNull
/// <summary>
/// 1.5新增,针对已删除用户应用 null object 模式
/// </summary>
/// <param name="obj"></param>
/// <param name="ep"></param>
/// <param name="propertyValue"></param>
public static void setEntityByCheckNull(IEntity obj, EntityPropertyInfo ep, Object propertyValue, int realUserId)
{
//Mobirds
//if (propertyValue == null && rft.IsInterface(ep.Type, typeof(IUser)))
//{
// IEntity user = getNullUser(realUserId);
// obj.set(ep.Name, user);
//}
//else
//{
// obj.set(ep.Name, propertyValue);
//}
obj.set(ep.Name, propertyValue);
}
示例6: Validate
public static Result Validate( IEntity target, String action )
{
EntityInfo entityInfo = Entity.GetInfo( target );
Result result = new Result();
foreach (EntityPropertyInfo info in entityInfo.SavedPropertyList) {
if (!info.SaveToDB) continue;
if (checkLength(info)) {
Object val = target.get( info.Name );
if( val != null )
target.set( info.Name, strUtil.SubString( val.ToString(), info.SaveAttribute.Length ) );
}
foreach (ValidationAttribute vattr in info.ValidationAttributes) {
vattr.Validate( action, target, info.Name, result );
}
}
return result;
}
示例7: setParentValueFromChild
private static void setParentValueFromChild( IEntity objParent, IEntity objChild )
{
List<EntityPropertyInfo> eplist = Entity.GetInfo( objParent ).SavedPropertyList;
foreach (EntityPropertyInfo info in eplist) {
objParent.set( info.Name, objChild.get( info.Name ) );
}
}
示例8: setPostValues
//-----------------------------------------------------------------------------------------------------------
private void setPostValues( EntityInfo ei, IEntity obj ) {
foreach (EntityPropertyInfo pInfo in ei.SavedPropertyList) {
if (pInfo.Name.Equals( "Id" )) continue;
string postValue = ctx.Post( pInfo.Name );
if (pInfo.IsLongText) {
if (rft.GetAttribute( pInfo.Property, typeof( HtmlTextAttribute ) ) != null) {
obj.set( pInfo.Name, ctx.PostHtmlAll( pInfo.Name ) );
}
else {
obj.set( pInfo.Name, postValue );
}
}
else if (pInfo.IsEntity) {
int postInt = cvt.ToInt( postValue );
IEntity pValue = Entity.New( pInfo.Type.FullName );
pValue.Id = postInt;
obj.set( pInfo.Name, pValue );
}
else {
object pValue2 = this.getPropertyValue( pInfo, postValue );
obj.set( pInfo.Name, pValue2 );
}
}
}