WebApplications.Testing.Data.SqlErrorCollectionPrototype.SqlErrorCollectionPrototype C# (CSharp) 메소드

SqlErrorCollectionPrototype() 정적인 개인적인 메소드

Creates the _constructor function and the _adder action.
static private SqlErrorCollectionPrototype ( ) : System
리턴 System
        static SqlErrorCollectionPrototype()
        {
            // Find constructor
            ConstructorInfo constructorInfo =
                typeof(SqlErrorCollection).GetConstructor(
                    BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.CreateInstance,
                    null,
                    Type.EmptyTypes,
                    null);
            Debug.Assert(constructorInfo != null);

            // Create lambda expression.
            _constructor = Expression.Lambda<Func<SqlErrorCollection>>(
                Expression.New(constructorInfo),
                Enumerable.Empty<ParameterExpression>()).Compile();

            // Find the add method
            MethodInfo addMethod = typeof(SqlErrorCollection).GetMethod(
                "Add",
                BindingFlags.NonPublic | BindingFlags.Instance |
                BindingFlags.InvokeMethod);
            Debug.Assert(addMethod != null);

            // Create instance parameter
            ParameterExpression instanceParameter = Expression.Parameter(typeof(SqlErrorCollection), "collection");

            // Create method parameter
            ParameterExpression errorParamter = Expression.Parameter(typeof(SqlError), "error");

            _adder =
                Expression.Lambda<Action<SqlErrorCollection, SqlError>>(
                    Expression.Call(instanceParameter, addMethod, errorParamter),
                    instanceParameter,
                    errorParamter).
                    Compile();
        }

Same methods

SqlErrorCollectionPrototype::SqlErrorCollectionPrototype ( [ collection ) : System