Beispiel #1
0
        /// <summary>
        /// We have to manually reset the app id because our profile provider is loaded from
        /// previous tests but we are destroying our database between tests.  This means that
        /// our provider thinks we have an application in our database when we really don't.
        /// Doing this will force the provider to generate a new app id.
        /// Note that this is not really a problem in a normal app that is not destroying
        /// the database behind the back of the provider.
        /// </summary>
        /// <param name="p"></param>
        private void ResetAppId(MySQLProfileProvider p)
        {
            Type      t  = p.GetType();
            FieldInfo fi = t.GetField("applicationId",
                                      BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.GetField);

            fi.SetValue(p, -1);
        }
Beispiel #2
0
        /// <summary>
        /// We have to manually reset the app id because our profile provider is loaded from
        /// previous tests but we are destroying our database between tests.  This means that
        /// our provider thinks we have an application in our database when we really don't.
        /// Doing this will force the provider to generate a new app id.
        /// Note that this is not really a problem in a normal app that is not destroying
        /// the database behind the back of the provider.
        /// </summary>
        /// <param name="p"></param>
        private void ResetAppId(MySQLProfileProvider p)
        {
            Type      t  = p.GetType();
            FieldInfo fi = t.GetField("app",
                                      BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.GetField);
            object       appObject = fi.GetValue(p);
            Type         appType   = appObject.GetType();
            PropertyInfo pi        = appType.GetProperty("Id");

            pi.SetValue(appObject, -1, null);
        }