本文整理汇总了C#中IType.PrepareValueProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IType.PrepareValueProperty方法的具体用法?C# IType.PrepareValueProperty怎么用?C# IType.PrepareValueProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IType
的用法示例。
在下文中一共展示了IType.PrepareValueProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetObject
public virtual IType SetObject(DataRow drow, IType iType)
{
foreach (PropertyInfo pi in iType.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic))
{
PropertyAttribute[] pAttribute = (PropertyAttribute[])pi.GetCustomAttributes(typeof(PropertyAttribute), false);
if (pAttribute != null && pAttribute.Length > 0 && (pAttribute[0].IsFieldBase))
{
object value = DBNull.Value;
try { value = drow[CType.GetPropertyName(pi)]; }
catch { }
pi.SetValue(iType, iType.PrepareValueProperty(value, pi.PropertyType), null);
}
}
iType.IsFull = true;
return iType;
}
示例2: Save
/// <summary>
/// Salva os dados na base através de parâmetros
/// </summary>
public virtual void Save(ref IType iType)
{
try
{
Cmd = DataBaseGeneric.CreateCommand(BaseType);
Cmd.CommandType = CommandType.StoredProcedure;
Cmd.CommandText = "sp_SYS_" + iType.GetType().Name + "_Salvar";
PropertyInfo cPk = SetParanSave(iType);
OpenConnectionTrans(iType);
if (cPk != null && cPk.GetValue(iType, null) == null)
cPk.SetValue(iType, iType.PrepareValueProperty(Cmd.ExecuteScalar(), cPk.PropertyType), null);
else Cmd.ExecuteNonQuery();
}
catch (Exception ex) { throw ex; }
finally { CloseConnection(iType); }
}
示例3: setDefaultValue
private static void setDefaultValue(IType objiType, PropertyAttribute[] pAttrProperty, PropertyInfo pi, ref string invalidFields, ref object value)
{
if (!string.IsNullOrEmpty(pAttrProperty[0].DefaultValue))
{
pi.SetValue(objiType, objiType.PrepareValueProperty(pAttrProperty[0].DefaultValue, pi.PropertyType), null);
value = pi.GetValue(objiType, null);
}
else invalidFields += pi.Name + " Não pode ser vazio \n";
}
示例4: setProperty
private void setProperty(IType iType)
{
foreach (PropertyInfo pi in this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic))
{
PropertyAttribute[] pAttProperty = (PropertyAttribute[])pi.GetCustomAttributes(typeof(PropertyAttribute), false);
if (pAttProperty != null && pAttProperty.Length > 0)
{
if (pAttProperty[0].IsPk && pi.GetValue(iType, null) == null) return;
if (pAttProperty[0].IsFieldBase)
pi.SetValue(this, iType.PrepareValueProperty(pi.GetValue(iType, null), pi.PropertyType), null);
}
}
}
示例5: Get
public static void Get(IType objiTypeValues, IType iType, string namePropertyId, string namePropertyName)
{
var pTipo = objiTypeValues.GetType().GetProperty(namePropertyId);
var pName = objiTypeValues.GetType().GetProperty(namePropertyName);
if (pTipo.GetValue(objiTypeValues, null) == null) throw new TradeVisionValidationError("IDTipo obrigatório para a ação GET");
var tipoTabelaColuna = new TipoTabelaColuna(iType);
tipoTabelaColuna.Get();
if (tipoTabelaColuna.IDTipoTabelaColuna != null)
{
var tipo = new Tipo();
tipo.TipoTabelaColuna = tipoTabelaColuna;
tipo.IDTipo = (int?)pTipo.GetValue(objiTypeValues, null);
tipo.Get();
if (tipo.IDTipo != null)
pName.SetValue(objiTypeValues, objiTypeValues.PrepareValueProperty(tipo.Nome, pName.PropertyType), null);
}
}