本文整理汇总了C#中Type.GetMeberOperationHelperContainer方法的典型用法代码示例。如果您正苦于以下问题:C# Type.GetMeberOperationHelperContainer方法的具体用法?C# Type.GetMeberOperationHelperContainer怎么用?C# Type.GetMeberOperationHelperContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Type
的用法示例。
在下文中一共展示了Type.GetMeberOperationHelperContainer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindIndexMethod
private static void FindIndexMethod(GenerateParametersInfo generateParametersInfo, Type type, StringBuilder stringBuilder, string string_2, string string_3)
{
MeberOperationHelperContainer class2 = type.GetMeberOperationHelperContainer(false);
foreach (KeyValuePair<string, MeberOperationHelper> pair in class2.GetDict())
{
if (!(pair.Value.GetDbColumnAttribute().IgnoreLoad || pair.Value.GetDbColumnAttribute().HasPrefix))
{
stringBuilder.AppendFormat("xx.{0} = FastDBEngine.MyExtensions.FindIndex(cc, \"{1}\");\r\n", generateParametersInfo.NameIndexDict[string_2 + pair.Key], string_3 + pair.Value.GetDbColumnAttribute().Alias);
}
}
foreach (KeyValuePair<string, MeberOperationHelper> pair in class2.GetDict())
{
if (!(pair.Value.GetDbColumnAttribute().IgnoreLoad || !pair.Value.GetDbColumnAttribute().HasPrefix))
{
FindIndexMethod(generateParametersInfo, pair.Value.GetPropertyType(), stringBuilder, string_2 + pair.Key + string_1, string_3 + pair.Value.GetDbColumnAttribute().SubItemPrefix);
}
}
}
示例2: SetGuidMethod
private static void SetGuidMethod(Type type, Dictionary<string, string> dict, string string_2)
{
MeberOperationHelperContainer class2 = type.GetMeberOperationHelperContainer(false);
foreach (KeyValuePair<string, MeberOperationHelper> pair in class2.GetDict())
{
if (!(pair.Value.GetDbColumnAttribute().IgnoreLoad || pair.Value.GetDbColumnAttribute().HasPrefix))
{
dict[string_2 + pair.Key] = GetGuid();
}
}
foreach (KeyValuePair<string, MeberOperationHelper> pair in class2.GetDict())
{
if (!(pair.Value.GetDbColumnAttribute().IgnoreLoad || !pair.Value.GetDbColumnAttribute().HasPrefix))
{
SetGuidMethod(pair.Value.GetPropertyType(), dict, string_2 + pair.Key + string_1);
}
}
}
示例3: LoadDatarowMethod
private static void LoadDatarowMethod(GenerateParametersInfo generateParametersInfo, Type type, StringBuilder stringBuilder, string string_2, string string_3)
{
MeberOperationHelperContainer meberOperationHelperContainer = type.GetMeberOperationHelperContainer(false);
foreach (KeyValuePair<string, MeberOperationHelper> pair in meberOperationHelperContainer.GetDict())
{
if (!pair.Value.GetDbColumnAttribute().IgnoreLoad && !pair.Value.GetDbColumnAttribute().HasPrefix)
{
stringBuilder.AppendFormat("if( xx.{0} >= 0 ) {{\r\n", generateParametersInfo.NameIndexDict[string_2 + pair.Key]);
if (!(!pair.Value.GetPropertyType().IsValueType || pair.Value.GetPropertyType().IsNullable()))
{
stringBuilder.AppendFormat("{0}{1} = ({2})(row[xx.{3}]);\r\n", new object[] { string_3, pair.Key, pair.Value.GetPropertyType().GetGenericArgumentsString(), generateParametersInfo.NameIndexDict[string_2 + pair.Key] });
}
else
{
stringBuilder.AppendFormat("object val = row[xx.{0}];\r\n", generateParametersInfo.NameIndexDict[string_2 + pair.Key]);
stringBuilder.AppendLine("if( val != null && DBNull.Value.Equals(val) == false )");
stringBuilder.AppendFormat("{0}{1} = ({2})(val);\r\n", string_3, pair.Key, pair.Value.GetPropertyType().IsNullable() ? pair.Value.GetPropertyType().GetFirstGenericArgumentsOrDefault().GetGenericArgumentsString() : pair.Value.GetPropertyType().GetGenericArgumentsString());
}
stringBuilder.AppendLine("}");
}
}
foreach (KeyValuePair<string, MeberOperationHelper> pair in meberOperationHelperContainer.GetDict())
{
if (!(pair.Value.GetDbColumnAttribute().IgnoreLoad || !pair.Value.GetDbColumnAttribute().HasPrefix))
{
stringBuilder.AppendFormat("{0}{1} = new {2}();\r\n", string_3, pair.Key, pair.Value.GetPropertyType().GetGenericArgumentsString());
LoadDatarowMethod(generateParametersInfo, pair.Value.GetPropertyType(), stringBuilder, string_2 + pair.Key + string_1, string_3 + pair.Key + ".");
}
}
}
示例4: GenerateMethodBody
private static void GenerateMethodBody(GenerateParametersInfo generateParametersInfo, Type type, StringBuilder stringBuilder, string prefix, string modelName)
{
MeberOperationHelperContainer meberOperationHelperContainer = type.GetMeberOperationHelperContainer(false);
//stringBuilder_0.AppendLine("try");
//stringBuilder_0.AppendLine("{ ");
// stringBuilder_0.AppendLine("System.Console.WriteLine(\"111111111111111111111111111\");");
foreach (KeyValuePair<string, MeberOperationHelper> pair in meberOperationHelperContainer.GetDict())
{
// stringBuilder_0.AppendFormat("System.Console.WriteLine(\"{0}\");\r\n", pair.Key);
if (!pair.Value.GetDbColumnAttribute().IgnoreLoad && !pair.Value.GetDbColumnAttribute().HasPrefix)
{
stringBuilder.AppendFormat("if( xx.{0} >= 0 ) {{\r\n", generateParametersInfo.NameIndexDict[prefix + pair.Key]);
if (pair.Value.GetPropertyType() == TypeInfo.TypeChar)
{
stringBuilder.AppendFormat("{0}{1} = reader.GetString(xx.{2})[0];\r\n", modelName, pair.Key, generateParametersInfo.NameIndexDict[prefix + pair.Key]);
}
else if (pair.Value.GetPropertyType() == typeof(char?))
{
stringBuilder.AppendFormat("object val = reader.GetValue(xx.{0});\r\n", generateParametersInfo.NameIndexDict[prefix + pair.Key]);
stringBuilder.AppendLine("if( val != null && DBNull.Value.Equals(val) == false ) {");
stringBuilder.AppendLine("string str = val.ToString();");
stringBuilder.AppendLine("if( str.Length > 0 ) ");
stringBuilder.AppendFormat("{0}{1} = str[0];\r\n", modelName, pair.Key);
stringBuilder.AppendLine("}");
}
else if (!(!pair.Value.GetPropertyType().IsValueType || pair.Value.GetPropertyType().IsNullable()))
{
if (!pair.Value.GetPropertyType().FullName.Contains("System.Int32"))
stringBuilder.AppendFormat("{0}{1} = {2}(xx.{3});\r\n", new object[] { modelName, pair.Key, GetReaderStr(pair.Value), generateParametersInfo.NameIndexDict[prefix + pair.Key] });
else
stringBuilder.AppendFormat("{0}{1} =Convert.ToInt32(reader.GetDecimal(xx.{2}));\r\n", new object[] { modelName, pair.Key, generateParametersInfo.NameIndexDict[prefix + pair.Key] });//, GetReaderStr(pair.Value)
}
else
{
stringBuilder.AppendFormat("object val = reader.GetValue(xx.{0});\r\n", generateParametersInfo.NameIndexDict[prefix + pair.Key]);
stringBuilder.AppendLine("if( val != null && DBNull.Value.Equals(val) == false )");
if (!pair.Value.GetPropertyType().FullName.Contains("System.Int32"))
stringBuilder.AppendFormat("{0}{1} = ({2})(val);\r\n", modelName, pair.Key, pair.Value.GetPropertyType().IsNullable() ? pair.Value.GetPropertyType().GetFirstGenericArgumentsOrDefault().GetGenericArgumentsString() : pair.Value.GetPropertyType().GetGenericArgumentsString());
else
stringBuilder.AppendFormat("{0}{1} = Convert.ToInt32((val));\r\n", modelName, pair.Key);//, pair.Value.method_3().IsNullable() ? pair.Value.method_3().smethod_3().smethod_7() : pair.Value.method_3().smethod_7());
}
stringBuilder.AppendLine("}");
}
}
//stringBuilder_0.AppendLine(" } ");
//stringBuilder_0.AppendLine("catch(Exception ex) { ");
//stringBuilder_0.AppendLine(" System.Diagnostics.Trace.WriteLine(ex.StackTrace);");
//stringBuilder_0.AppendLine(" } ");
foreach (KeyValuePair<string, MeberOperationHelper> pair in meberOperationHelperContainer.GetDict())
{
if (!(pair.Value.GetDbColumnAttribute().IgnoreLoad || !pair.Value.GetDbColumnAttribute().HasPrefix))
{
stringBuilder.AppendFormat("{0}{1} = new {2}();\r\n", modelName, pair.Key, pair.Value.GetPropertyType().GetGenericArgumentsString());
GenerateMethodBody(generateParametersInfo, pair.Value.GetPropertyType(), stringBuilder, prefix + pair.Key + string_1, modelName + pair.Key + ".");
}
}
}