当前位置: 首页>>代码示例>>C#>>正文


C# Int32.Name方法代码示例

本文整理汇总了C#中System.Int32.Name方法的典型用法代码示例。如果您正苦于以下问题:C# Int32.Name方法的具体用法?C# Int32.Name怎么用?C# Int32.Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Int32的用法示例。


在下文中一共展示了Int32.Name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddStoredProcedure

        /// <summary>
        /// Create and add a StoredProcedure instance to this Database.
        /// <para>The name parameter must be a valid one-part or two-part T-SQL identifier.  Square brackets around the name parts are optional.</para>
        /// <para>E.g. "my_stored_proc", "[my_stored_proc]", "my_schema.my_stored_proc", and "[my_schema].[my_stored_proc]" are all valid name identifiers.</para>
        /// <para>Names with more than two parts, or missing parts, are considered errors.</para>
        /// </summary>
        public StoredProcedure AddStoredProcedure(String name, Int32 versionNumber, params SqlParameter[] sqlParameters)
        {
            name.Name("name").NotNullEmptyOrOnlyWhitespace();
              versionNumber.Name("versionNumber").GreaterThan(0);

              name = IdentifierHelper.GetStrippedSqlIdentifier(name);
              var nameParts = name.Split(".".ToCharArray(), StringSplitOptions.None);

              /* It's an error if any of the name parts are empty,
             and this method only accepts one-part ([object name]) or
             two-part ([schema name].[object name]) T-SQL identifiers. */
              if (nameParts.Any(s => s.IsEmpty()) || (nameParts.Length > 2))
            throw new ArgumentExceptionFmt(Properties.Resources.InvalidStoredProcedureName, name);

              /* At this point, all of the name parts have been validated for correct form. */

              if (nameParts.Length == 1)
              {
            return this.Schemas.GetDefaultSchema().AddStoredProcedure(name, versionNumber, sqlParameters);
              }
              else
              {
            var schemaName = nameParts[0];
            var schema = this.Schemas.GetByName(schemaName);
            if (schema == null)
              throw new ExceptionFmt(Properties.Resources.SchemaNameNotFound, schemaName);

            var storedProcedureName = nameParts[1];

            return schema.AddStoredProcedure(storedProcedureName, versionNumber, sqlParameters);
              }
        }
开发者ID:ctimmons,项目名称:cs_utilities,代码行数:38,代码来源:Database.cs

示例2: AddStoredProcedure

        public StoredProcedure AddStoredProcedure(String name, Int32 versionNumber, params SqlParameter[] sqlParameters)
        {
            name.Name("name").NotNullEmptyOrOnlyWhitespace();
              versionNumber.Name("versionNumber").GreaterThan(0);

              name = IdentifierHelper.GetBracketedSqlIdentifier(name);

              if (name.Contains("."))
            throw new ArgumentExceptionFmt(Properties.Resources.InvalidStoredProcedureNameForSchema, name);

              if (this.StoredProcedures.GetByName(name, versionNumber) == null)
              {
            var sp = new StoredProcedure(this, name, versionNumber, sqlParameters);
            this.StoredProcedures.Add(sp);
            return sp;
              }
              else
              {
            throw new ExceptionFmt(Properties.Resources.StoredProcedureAlreadyExists, name, versionNumber);
              }
        }
开发者ID:ctimmons,项目名称:cs_utilities,代码行数:21,代码来源:Schema.cs


注:本文中的System.Int32.Name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。