MVC+LINQToSQL的Repository模式之(四)数据统一更新的附加类

namespace public static class DynamicQueryable
    public static IQueryablethis IQueryablestring params objectreturn IQueryableIQueryablepublic static IQueryable this IQueryable string params objectif nullthrow new ArgumentNullException"source"if nullthrow new ArgumentNullException"predicate"LambdaExpression DynamicExpressiontypeofboolreturn ExpressiontypeofQueryable"Where"new TypeExpressionpublic static IQueryable this IQueryable string params objectif nullthrow new ArgumentNullException"source"if nullthrow new ArgumentNullException"selector"LambdaExpression DynamicExpressionnullreturn ExpressiontypeofQueryable"Select"new TypeExpressionpublic static IQueryablethis IQueryablestring params objectreturn IQueryableIQueryablepublic static IQueryable this IQueryable string params objectif nullthrow new ArgumentNullException"source"if nullthrow new ArgumentNullException"ordering"ParameterExpressionnew ParameterExpressionExpression""ExpressionParser new ExpressionParserIEnumerableDynamicOrderingExpression string "OrderBy"string "OrderByDescending"foreach DynamicOrdering in ExpressiontypeofQueryablenew TypeExpressionExpression"ThenBy""ThenByDescending"return public static IQueryable this IQueryable int if nullthrow new ArgumentNullException"source"return ExpressiontypeofQueryable"Take"new TypeExpressionpublic static IQueryable this IQueryable int if nullthrow new ArgumentNullException"source"return ExpressiontypeofQueryable"Skip"new TypeExpressionpublic static IQueryable this IQueryable string string params objectif nullthrow new ArgumentNullException"source"if nullthrow new ArgumentNullException"keySelector"if nullthrow new ArgumentNullException"elementSelector"LambdaExpression DynamicExpressionnullLambdaExpression DynamicExpressionnullreturn ExpressiontypeofQueryable"GroupBy"new TypeExpressionExpressionpublic static bool this IQueryable if nullthrow new ArgumentNullException"source"return boolExpressiontypeofQueryable"Any"new Typepublic static int this IQueryable if nullthrow new ArgumentNullException"source"return intExpressiontypeofQueryable"Count"new Typepublic abstract class DynamicClass
    public override string PropertyInfothisBindingFlagsBindingFlagsStringBuilder new StringBuilder"{"for int if ", ""="thisnull"}"return public class DynamicProperty
    string Type public string Type if nullthrow new ArgumentNullException"name"if nullthrow new ArgumentNullException"type"thisthispublic string get return public Type get return public static class DynamicExpression
    public static Expression Type string params objectExpressionParser new ExpressionParsernullreturn public static LambdaExpression Type Type string params objectreturn new ParameterExpressionExpression""public static LambdaExpression ParameterExpressionType string params objectExpressionParser new ExpressionParserreturn Expressionpublic static ExpressionFuncstring params objectreturn ExpressionFunctypeoftypeofpublic static Type params DynamicPropertyreturn ClassFactorypublic static Type IEnumerableDynamicPropertyreturn ClassFactoryinternal class DynamicOrdering
    public Expression public bool internal class Signature IEquatableSignaturepublic DynamicPropertypublic int public IEnumerableDynamicPropertythisforeach DynamicProperty in public override int return public override bool object return is Signature Signaturefalsepublic bool Signature if return falsefor int if return falsereturn trueinternal class ClassFactory
    public static readonly ClassFactory new ClassFactorystatic // Trigger lazy initialization of static fields

        ModuleBuilder DictionarySignatureTypeint ReaderWriterLock private AssemblyName new AssemblyName"DynamicClasses"AssemblyBuilder AppDomainAssemblyBuilderAccess#if new ReflectionPermission(PermissionState.Unrestricted).Assert();
#endif
            try "Module"finally #if PermissionSet.RevertAssert();
#endif
            new DictionarySignatureTypenew ReaderWriterLockpublic Type IEnumerableDynamicPropertyTimeouttry Signature new SignatureType if out return finally Type DynamicPropertyLockCookie Timeouttry string "DynamicClass" #if new ReflectionPermission(PermissionState.Unrestricted).Assert();
#endif
                try TypeBuilder thisTypeAttributesTypeAttributestypeofDynamicClassFieldInfoType return finally #if PermissionSet.RevertAssert();
#endif
                finally ref FieldInfoTypeBuilder DynamicPropertyFieldInfonew FieldBuilderfor int DynamicProperty FieldBuilder "_" FieldAttributesPropertyBuilder PropertyAttributesnullMethodBuilder "get_" MethodAttributesMethodAttributesMethodAttributesTypeILGenerator OpCodesOpCodesOpCodesMethodBuilder "set_" MethodAttributesMethodAttributesMethodAttributesnullnew TypeILGenerator OpCodesOpCodesOpCodesOpCodesreturn void TypeBuilder FieldInfoMethodBuilder "Equals"MethodAttributesMethodAttributesMethodAttributesMethodAttributestypeofboolnew TypetypeofobjectILGenerator LocalBuilder Label OpCodesOpCodesOpCodesOpCodesOpCodesOpCodesOpCodesforeach FieldInfo in Type Type typeofEqualityComparerOpCodes"get_Default"nullOpCodesOpCodesOpCodesOpCodesOpCodes"Equals"new TypenullOpCodesOpCodesOpCodesOpCodesOpCodesvoid TypeBuilder FieldInfoMethodBuilder "GetHashCode"MethodAttributesMethodAttributesMethodAttributesMethodAttributestypeofintTypeILGenerator OpCodesforeach FieldInfo in Type Type typeofEqualityComparerOpCodes"get_Default"nullOpCodesOpCodesOpCodes"GetHashCode"new TypenullOpCodesOpCodespublic sealed class ParseException Exception
    int public string int basethispublic int get return public override string return stringResinternal class ExpressionParser
    struct Token
        public TokenId public string public int enum TokenId
        interface ILogicalSignatures
        void bool bool void boolboolinterface IArithmeticSignatures
        void int int void uint uint void long long void ulong ulong void float float void double double void decimal decimal void intintvoid uintuintvoid longlongvoid ulongulongvoid floatfloatvoid doubledoublevoid decimaldecimalinterface IRelationalSignatures IArithmeticSignatures
        void string string void char char void DateTime DateTime void TimeSpan TimeSpan void charcharvoid DateTimeDateTimevoid TimeSpanTimeSpaninterface IEqualitySignatures IRelationalSignatures
        void bool bool void boolboolinterface IAddSignatures IArithmeticSignatures
        void DateTime TimeSpan void TimeSpan TimeSpan void DateTimeTimeSpanvoid TimeSpanTimeSpaninterface ISubtractSignatures IAddSignatures
        void DateTime DateTime void DateTimeDateTimeinterface INegationSignatures
        void int void long void float void double void decimal void intvoid longvoid floatvoid doublevoid decimalinterface INotSignatures
        void bool void boolinterface IEnumerableSignatures
        void bool void void bool void bool void void bool void object void object void int void intvoid long void longvoid float void floatvoid double void doublevoid decimal void decimalvoid int void intvoid long void longvoid float void floatvoid double void doublevoid decimal void decimalstatic readonly TypetypeofObjecttypeofBooleantypeofChartypeofStringtypeofSBytetypeofBytetypeofInt16typeofUInt16typeofInt32typeofUInt32typeofInt64typeofUInt64typeofSingletypeofDoubletypeofDecimaltypeofDateTimetypeofTimeSpantypeofGuidtypeofMathtypeofConvertstatic readonly Expression Expressiontruestatic readonly Expression Expressionfalsestatic readonly Expression Expressionnullstatic readonly string "it"static readonly string "iif"static readonly string "new"static DictionarystringobjectDictionarystringobjectIDictionarystringobjectDictionaryExpressionstringParameterExpression string int int char Token public ParameterExpressionstring objectif nullthrow new ArgumentNullException"expression"if nullnew DictionarystringobjectStringComparernew DictionaryExpressionstringif nullif nullvoid ParameterExpressionforeach ParameterExpression in if Stringif Stringvoid objectfor int object if is IDictionarystringobjectIDictionarystringobjectelse "@" CultureInfovoid string object if throw Respublic Expression Type int Expression if nullif truenullthrow ResTokenIdResreturn #pragma public IEnumerableDynamicOrderingListDynamicOrderingnew ListDynamicOrderingwhile trueExpression bool trueif "asc""ascending"else if "desc""descending"falsenew DynamicOrdering if TokenIdbreakTokenIdResreturn #pragma // ?: operator
        Expression int Expression if TokenIdExpression TokenIdResExpression return // ||, or operator
        Expression Expression while TokenId"or"Token Expression typeofILogicalSignaturesref ref Expressionreturn // &&, and operator
        Expression Expression while TokenId"and"Token Expression typeofILogicalSignaturesref ref Expressionreturn // =, ==, !=, <>, >, >=, <, <= operators
        Expression Expression while TokenIdTokenIdTokenIdTokenIdTokenIdTokenIdTokenIdTokenIdToken Expression bool TokenIdTokenIdTokenIdTokenIdif if if Expressionelse if Expressionelse throw else if if Expression if truenullelse if truenullelse throw else typeofIEqualitySignaturestypeofIRelationalSignaturesref ref switch case TokenIdcase TokenIdbreakcase TokenIdcase TokenIdbreakcase TokenIdbreakcase TokenIdbreakcase TokenIdbreakcase TokenIdbreakreturn // +, -, & operators
        Expression Expression while TokenIdTokenIdTokenIdToken Expression switch case TokenIdif typeofstringtypeofstringgoto case typeofIAddSignaturesref ref breakcase TokenIdtypeofISubtractSignaturesref ref breakcase TokenIdbreakreturn // *, /, %, mod operators
        Expression Expression while TokenIdTokenIdTokenId"mod"Token Expression typeofIArithmeticSignaturesref ref switch case TokenIdExpressionbreakcase TokenIdExpressionbreakcase TokenIdcase TokenIdExpressionbreakreturn // -, !, not unary operators
        Expression if TokenIdTokenId"not"Token if TokenIdTokenIdTokenId"-" return Expression if TokenIdtypeofINegationSignaturesref Expressionelse typeofINotSignaturesref Expressionreturn return Expression Expression while trueif TokenIdnullelse if TokenIdelse breakreturn Expression switch case TokenIdreturn case TokenIdreturn case TokenIdreturn case TokenIdreturn case TokenIdreturn defaultthrow ResExpression TokenIdchar string int while trueint if breakif '\''if throw Resreturn return Expression TokenIdstring if '-'ulong if UInt64out throw Resif ulongInt32return intif ulongUInt32return uintif ulongInt64return longreturn else long if Int64out throw Resif Int32Int32return intreturn Expression TokenIdstring object nullchar if 'F' 'f'float if Singleout else double if Doubleout if nullthrow Resreturn Expression object string ConstantExpression Expressionreturn Expression TokenIdResExpression TokenIdResreturn Expression TokenIdobject if out if is Typereturn Typeif objectreturn if objectreturn if objectreturn return Expressionif out null out Expression as Expressionif nullExpressionelse LambdaExpression as LambdaExpressionif nullreturn return if nullreturn nullthrow ResExpression if nullthrow Resreturn Expression int Expressionif throw Resreturn Expression Expression Expression Expression int if typeofboolthrow Resif Expression truenullExpression truenullif null nullelse if null nullelse string "null"string "null"if null nullthrow Resthrow Resreturn ExpressionExpression TokenIdResListDynamicPropertynew ListDynamicPropertyListExpressionnew ListExpressionwhile trueint Expression string if "as"else MemberExpression as MemberExpressionif nullthrow Resnew DynamicPropertyif TokenIdbreakTokenIdResType DynamicExpressionMemberBindingnew MemberBindingfor int Expressionreturn ExpressionExpressionExpression LambdaExpression int ExpressionMethodBase if "Invoke"falseout throw Resreturn ExpressionExpression Type int if TokenIdif throw RestypeofNullableif TokenIdExpressionMethodBase switch out case if return throw Rescase return ExpressionConstructorInfodefaultthrow ResTokenIdResreturn nullExpression Expression Type int Type if return if if return Expressionif return Expressionif return Expressionthrow ResExpression Type Expression if nullint string if TokenIdif null typeofstringType typeofIEnumerableif nullType return ExpressionMethodBase switch nullout case throw Rescase MethodInfo MethodInfoif throw Resif typeofvoidthrow Resreturn ExpressionMethodInfodefaultthrow Reselse MemberInfo nullif nullthrow Resreturn is PropertyInfo ExpressionPropertyInfoExpressionFieldInfostatic Type Type Type while null typeofobjectif return if foreach Type in Type if nullreturn return nullExpression Expression Type string int ParameterExpression ParameterExpression Expression""ExpressionMethodBase if typeofIEnumerableSignaturesfalseout throw ResTypeif "Min" "Max"new Typeelse new Typeif new Expressionelse new ExpressionExpressionreturn ExpressiontypeofEnumerableExpressionTokenIdResExpressionTokenIdnew ExpressionTokenIdResreturn ExpressionListExpressionnew ListExpressionwhile trueif TokenIdbreakreturn Expression Expression int TokenIdResExpressionTokenIdResif if throw ResExpression typeofinttrueif nullthrow Resreturn Expressionelse MethodBase switch out case throw Rescase return ExpressionMethodInfodefaultthrow Resstatic bool Type foreach Type in if return truereturn falsestatic bool Type return typeofNullablestatic Type Type return static string Type Type string if '?'return static bool Type return static bool Type return static bool Type return static int Type if return switch Typecase TypeCodecase TypeCodecase TypeCodecase TypeCodereturn case TypeCodecase TypeCodecase TypeCodecase TypeCodereturn case TypeCodecase TypeCodecase TypeCodecase TypeCodereturn defaultreturn static bool Type return void Type string ref Expression int Expressionnew ExpressionMethodBase if "F"falseout throw Resvoid Type string ref Expression ref Expression int Expressionnew ExpressionMethodBase if "F"falseout throw Exception string Expression Expression int return ResMemberInfo Type string bool BindingFlags BindingFlagsBindingFlagsBindingFlagsBindingFlagsforeach Type in MemberInfoMemberTypesMemberTypesTypeif return return nullint Type string bool Expressionout MethodBase BindingFlags BindingFlagsBindingFlagsBindingFlagsBindingFlagsforeach Type in MemberInfoMemberTypesTypeint MethodBaseout if return nullreturn int Type Expressionout MethodBase foreach Type in MemberInfoif IEnumerableMethodBasePropertyInfoMethodBasenullint out if return nullreturn static IEnumerableTypeType if ListTypenew ListTypereturn return static IEnumerableTypeType while nullyield return static void ListTypeType if foreach Type in class MethodData
        public MethodBase public ParameterInfopublic Expressionint IEnumerableMethodBaseExpressionout MethodBase MethodDatanew MethodData if if MethodData for int else nullreturn bool MethodData Expressionif return falseExpressionnew Expressionfor int ParameterInfo if return falseExpression falseif nullreturn falsereturn trueExpression Expression Type bool if return if is ConstantExpressionConstantExpression ConstantExpressionif if return Expressionnullelse string if out Type Object nullswitch Typecase TypeCodecase TypeCodecase TypeCodecase TypeCodebreakcase TypeCodeif typeofdecimalbreakcase TypeCodebreakif nullreturn Expressionif if return Expressionreturn return nullstatic object string Type switch Typecase TypeCodesbyte if sbyteout return breakcase TypeCodebyte if byteout return breakcase TypeCodeshort if shortout return breakcase TypeCodeushort if ushortout return breakcase TypeCodeint if intout return breakcase TypeCodeuint if uintout return breakcase TypeCodelong if longout return breakcase TypeCodeulong if ulongout return breakcase TypeCodefloat if floatout return breakcase TypeCodedouble if doubleout return breakcase TypeCodedecimal if decimalout return breakreturn nullstatic object string Type if MemberInfoMemberTypesBindingFlagsBindingFlagsBindingFlagsTypeif return FieldInfonullreturn nullstatic bool Type Type if return trueif return Type Type if return falseTypeCode TypeCodeTypeTypeCode TypeCodeTypeswitch case TypeCodeswitch case TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodereturn truebreakcase TypeCodeswitch case TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodereturn truebreakcase TypeCodeswitch case TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodereturn truebreakcase TypeCodeswitch case TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodereturn truebreakcase TypeCodeswitch case TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodereturn truebreakcase TypeCodeswitch case TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodecase TypeCodereturn truebreakcase TypeCodeswitch case TypeCodecase TypeCodecase TypeCodecase TypeCodereturn truebreakcase TypeCodeswitch case TypeCodecase TypeCodecase TypeCodecase TypeCodereturn truebreakcase TypeCodeswitch case TypeCodecase TypeCodereturn truebreakdefaultif return truebreakreturn falsestatic bool ExpressionMethodData MethodData bool falsefor int int if return falseif truereturn // Return 1 if s -> t1 is a better conversion than s -> t2
        // Return -1 if s -> t2 is a better conversion than s -> t1
        // Return 0 if neither conversion is better
        static int Type Type Type if return if return if return bool bool if return if return if return if return return Expression Expression Expression return ExpressionExpression Expression Expression return ExpressionExpression Expression Expression if typeofstringreturn Expression"Compare"Expressionreturn ExpressionExpression Expression Expression if typeofstringreturn Expression"Compare"Expressionreturn ExpressionExpression Expression Expression if typeofstringreturn Expression"Compare"Expressionreturn ExpressionExpression Expression Expression if typeofstringreturn Expression"Compare"Expressionreturn ExpressionExpression Expression Expression if typeofstringtypeofstringreturn "Concat"return ExpressionExpression Expression Expression return ExpressionExpression Expression Expression return Expressionnulltypeofstring"Concat"newtypeofobjecttypeofobjectnewMethodInfo string Expression Expression return newExpression string Expression Expression return Expressionnullnewvoid int '\0'void if '\0'void while CharTokenId int switch case '!'if '='TokenIdelse TokenIdbreakcase '%'TokenIdbreakcase '&'if '&'TokenIdelse TokenIdbreakcase '('TokenIdbreakcase ')'TokenIdbreakcase '*'TokenIdbreakcase '+'TokenIdbreakcase ','TokenIdbreakcase '-'TokenIdbreakcase '.'TokenIdbreakcase '/'TokenIdbreakcase ':'TokenIdbreakcase '<'if '='TokenIdelse if '>'TokenIdelse TokenIdbreakcase '='if '='TokenIdelse TokenIdbreakcase '>'if '='TokenIdelse TokenIdbreakcase '?'TokenIdbreakcase '['TokenIdbreakcase ']'TokenIdbreakcase '|'if '|'TokenIdelse TokenIdbreakcase '"'case '\''char do while if throw Reswhile TokenIdbreakdefaultif Char'@' '_'do while Char'_'TokenIdbreakif CharTokenIddo while Charif '.'TokenIddo while Charif 'E' 'e'TokenIdif '+' '-'do while Charif 'F' 'f'breakif TokenIdbreakthrow Resbool string return TokenIdStringStringComparisonstring TokenIdResstring if '@'return void if Charthrow Resvoid TokenId string if throw void TokenId if throw ResException string params objectreturn Exception int string params objectreturn new ParseExceptionstringCultureInfostatic DictionarystringobjectDictionarystringobjectnew DictionarystringobjectStringComparer"true""false""null"foreach Type in return static class Res
    public const string "The identifier '{0}' was defined more than once"public const string "Expression of type '{0}' expected"public const string "Expression expected"public const string "Character literal must contain exactly one character"public const string "Invalid integer literal '{0}'"public const string "Invalid real literal '{0}'"public const string "Unknown identifier '{0}'"public const string "No 'it' is in scope"public const string "The 'iif' function requires three arguments"public const string "The first expression must be of type 'Boolean'"public const string "Both of the types '{0}' and '{1}' convert to the other"public const string "Neither of the types '{0}' and '{1}' converts to the other"public const string "Expression is missing an 'as' clause"public const string "Argument list incompatible with lambda expression"public const string "Type '{0}' has no nullable form"public const string "No matching constructor in type '{0}'"public const string "Ambiguous invocation of '{0}' constructor"public const string "A value of type '{0}' cannot be converted to type '{1}'"public const string "No applicable method '{0}' exists in type '{1}'"public const string "Methods on type '{0}' are not accessible"public const string "Method '{0}' in type '{1}' does not return a value"public const string "Ambiguous invocation of method '{0}' in type '{1}'"public const string "No property or field '{0}' exists in type '{1}'"public const string "No applicable aggregate method '{0}' exists"public const string "Indexing of multi-dimensional arrays is not supported"public const string "Array index must be an integer expression"public const string "No applicable indexer exists in type '{0}'"public const string "Ambiguous invocation of indexer in type '{0}'"public const string "Operator '{0}' incompatible with operand type '{1}'"public const string "Operator '{0}' incompatible with operand types '{1}' and '{2}'"public const string "Unterminated string literal"public const string "Syntax error '{0}'"public const string "Digit expected"public const string "Syntax error"public const string "{0} expected"public const string "{0} (at index {1})"public const string "':' expected"public const string "'(' expected"public const string "')' or operator expected"public const string "')' or ',' expected"public const string "'.' or '(' expected"public const string "'[' expected"public const string "']' or ',' expected"public const string "Identifier expected"

}

本文转自博客园张占岭(仓储大叔)的博客,原文链接:MVC+LINQToSQL的Repository模式之(四)数据统一更新的附加类,如需转载请自行联系原博主。

上一篇:JS实现复制功能


下一篇:web程序设计基础——学习通选择判断复习(3)