當前位置: 首頁>>代碼示例>>C#>>正文


C# ProviderBase.ToString方法代碼示例

本文整理匯總了C#中System.Configuration.Provider.ProviderBase.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# ProviderBase.ToString方法的具體用法?C# ProviderBase.ToString怎麽用?C# ProviderBase.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Configuration.Provider.ProviderBase的用法示例。


在下文中一共展示了ProviderBase.ToString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CheckSchemaVersion

        internal static void CheckSchemaVersion(ProviderBase provider, SqlConnection connection, string[] features, string version, ref int schemaVersionCheck) {
            if (connection == null) {
                throw new ArgumentNullException("connection");
            }

            if (features == null) {
                throw new ArgumentNullException("features");
            }

            if (version == null) {
                throw new ArgumentNullException("version");
            }

            if (schemaVersionCheck == -1) {
                throw new ProviderException(SR.GetString(SR.Provider_Schema_Version_Not_Match, provider.ToString(), version));
            }
            else if (schemaVersionCheck == 0) {
                lock (provider) {
                    if (schemaVersionCheck == -1) {
                        throw new ProviderException(SR.GetString(SR.Provider_Schema_Version_Not_Match, provider.ToString(), version));
                    }
                    else if (schemaVersionCheck == 0) {
                        int iStatus = 0;
                        SqlCommand cmd = null;
                        SqlParameter p = null;

                        foreach (string feature in features) {
                            cmd = new SqlCommand("dbo.aspnet_CheckSchemaVersion", connection);

                            cmd.CommandType = CommandType.StoredProcedure;

                            p = new SqlParameter("@Feature", feature);
                            cmd.Parameters.Add(p);

                            p = new SqlParameter("@CompatibleSchemaVersion", version);
                            cmd.Parameters.Add(p);

                            p = new SqlParameter("@ReturnValue", SqlDbType.Int);
                            p.Direction = ParameterDirection.ReturnValue;
                            cmd.Parameters.Add(p);

                            cmd.ExecuteNonQuery();

                            iStatus = ((p.Value != null) ? ((int)p.Value) : -1);
                            if (iStatus != 0) {
                                schemaVersionCheck = -1;

                                throw new ProviderException(SR.GetString(SR.Provider_Schema_Version_Not_Match, provider.ToString(), version));
                            }
                        }

                        schemaVersionCheck = 1;
                    }
                }
            }
        }
開發者ID:JokerMisfits,項目名稱:linux-packaging-mono,代碼行數:56,代碼來源:SecUtil.cs

示例2: CheckSchemaVersion

        internal static void CheckSchemaVersion(ProviderBase provider, SqlConnection connection, string[] features, string version, ref int schemaVersionCheck)
        {
            if (connection == null) {
                throw new ArgumentNullException("connection");
            }

            if (features == null) {
                throw new ArgumentNullException("feature");
            }

            if (version == null) {
                throw new ArgumentNullException("version");
            }

            if (schemaVersionCheck == -1) {
                throw new Exception("The '" + provider.ToString() + "' requires a database schema compatible with schema version '" + version + "'.  However, the current database schema is not compatible with this version.  You may need to either install a compatible schema with aspnet_reqsql.exe (available in the framework installation directory), or upgrade the provider to a newer version.");
            }
            else if (schemaVersionCheck == 0) {
                lock (provider) {
                    if (schemaVersionCheck == -1) {
                        throw new Exception("The '" + provider.ToString() + "' requires a database schema compatible with schema version '" + version + "'.  However, the current database schema is not compatible with this version.  You may need to either install a compatible schema with aspnet_reqsql.exe (available in the framework installation directory), or upgrade the provider to a newer version.");
                    }
                    else if (schemaVersionCheck == 0) {
                        int iStatus = 0;
                        SqlCommand cmd = null;
                        SqlParameter p = null;

                        foreach (string feature in features) {
                            cmd = new SqlCommand("dbo.aspnet_CheckSchemaVersion", connection);

                            cmd.CommandType = CommandType.StoredProcedure;

                            p = new SqlParameter("@Feature", feature);
                            cmd.Parameters.Add(p);

                            p = new SqlParameter("@CompatibleSchemaVersion", version);
                            cmd.Parameters.Add(p);

                            p = new SqlParameter("@ReturnValue", SqlDbType.Int);
                            p.Direction = ParameterDirection.ReturnValue;
                            cmd.Parameters.Add(p);

                            cmd.ExecuteNonQuery();

                            iStatus = ((p.Value != null) ? ((int)p.Value) : -1);
                            if (iStatus != 0) {
                                schemaVersionCheck = -1;

                                throw new Exception("The '" + provider.ToString() + "' requires a database schema compatible with schema version '" + version + "'.  However, the current database schema is not compatible with this version.  You may need to either install a compatible schema with aspnet_reqsql.exe (available in the framework installation directory), or upgrade the provider to a newer version.");
                            }
                        }

                        schemaVersionCheck = 1;
                    }
                }
            }
        }
開發者ID:vbyte,項目名稱:fmq,代碼行數:57,代碼來源:SecUtil.cs

示例3: CheckSchemaVersion

 internal static void CheckSchemaVersion(ProviderBase provider, SqlConnection connection, string[] features, string version, ref int schemaVersionCheck)
 {
     if (connection == null)
     {
         throw new ArgumentNullException("connection");
     }
     if (features == null)
     {
         throw new ArgumentNullException("features");
     }
     if (version == null)
     {
         throw new ArgumentNullException("version");
     }
     if (schemaVersionCheck == -1)
     {
         throw new ProviderException(System.Web.SR.GetString("Provider_Schema_Version_Not_Match", new object[] { provider.ToString(), version }));
     }
     if (schemaVersionCheck == 0)
     {
         lock (provider)
         {
             if (schemaVersionCheck == -1)
             {
                 throw new ProviderException(System.Web.SR.GetString("Provider_Schema_Version_Not_Match", new object[] { provider.ToString(), version }));
             }
             if (schemaVersionCheck == 0)
             {
                 SqlCommand command = null;
                 SqlParameter parameter = null;
                 foreach (string str in features)
                 {
                     command = new SqlCommand("dbo.aspnet_CheckSchemaVersion", connection) {
                         CommandType = CommandType.StoredProcedure
                     };
                     parameter = new SqlParameter("@Feature", str);
                     command.Parameters.Add(parameter);
                     parameter = new SqlParameter("@CompatibleSchemaVersion", version);
                     command.Parameters.Add(parameter);
                     parameter = new SqlParameter("@ReturnValue", SqlDbType.Int) {
                         Direction = ParameterDirection.ReturnValue
                     };
                     command.Parameters.Add(parameter);
                     command.ExecuteNonQuery();
                     if (((parameter.Value != null) ? ((int) parameter.Value) : -1) != 0)
                     {
                         schemaVersionCheck = -1;
                         throw new ProviderException(System.Web.SR.GetString("Provider_Schema_Version_Not_Match", new object[] { provider.ToString(), version }));
                     }
                 }
                 schemaVersionCheck = 1;
             }
         }
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:55,代碼來源:SecUtility.cs


注:本文中的System.Configuration.Provider.ProviderBase.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。