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


C# SqlGenerator类代码示例

本文整理汇总了C#中SqlGenerator的典型用法代码示例。如果您正苦于以下问题:C# SqlGenerator类的具体用法?C# SqlGenerator怎么用?C# SqlGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GenerateSql

        /// <summary> Generates the Sql </summary>
        /// <param name="name">        The name. </param>
        /// <param name="primaryKeys"> The item. </param>
        /// <param name="properties">  The properties. </param>
        /// <returns> The sql. </returns>
        public string GenerateSql(string name, IList<Property> primaryKeys, IList<Property> properties)
        {
            SqlGenerator generator = new SqlGenerator();
            string sql = generator.Insert(name, properties);

            return sql;
        }
开发者ID:chuckconway,项目名称:Hypersonic,代码行数:12,代码来源:PrimaryKeysNotDefined.cs

示例2: WriteSql

 /// <summary>
 ///     We delegate the writing of the fragment to the appropriate type.
 /// </summary>
 /// <param name="writer"> </param>
 /// <param name="sqlGenerator"> </param>
 public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
 {
     if (null != _sqlFragments)
     {
         foreach (var o in _sqlFragments)
         {
             var str = (o as String);
             if (null != str)
             {
                 writer.Write(str);
             }
             else
             {
                 var sqlFragment = (o as ISqlFragment);
                 if (null != sqlFragment)
                 {
                     sqlFragment.WriteSql(writer, sqlGenerator);
                 }
                 else
                 {
                     throw new InvalidOperationException();
                 }
             }
         }
     }
 }
开发者ID:hallco978,项目名称:entityframework,代码行数:31,代码来源:SqlBuilder.cs

示例3: WriteSql

        /// <summary>
        ///     Write this symbol out as a string for sql.  This is just
        ///     the new name of the symbol (which could be the same as the old name).
        ///     We rename columns here if necessary.
        /// </summary>
        /// <param name="writer"> </param>
        /// <param name="sqlGenerator"> </param>
        public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
        {
            if (NeedsRenaming)
            {
                int i;

                if (sqlGenerator.AllColumnNames.TryGetValue(NewName, out i))
                {
                    string newNameCandidate;
                    do
                    {
                        ++i;
                        newNameCandidate = NewName + i.ToString(CultureInfo.InvariantCulture);
                    }
                    while (sqlGenerator.AllColumnNames.ContainsKey(newNameCandidate));

                    sqlGenerator.AllColumnNames[NewName] = i;

                    NewName = newNameCandidate;
                }

                // Add this column name to list of known names so that there are no subsequent
                // collisions
                sqlGenerator.AllColumnNames[NewName] = 0;

                // Prevent it from being renamed repeatedly.
                NeedsRenaming = false;
            }
            writer.Write(SqlGenerator.QuoteIdentifier(NewName));
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:37,代码来源:Symbol.cs

示例4: WriteSql

        /// <summary>
        ///     Write out the TOP part of sql select statement
        ///     It basically writes TOP (X) [WITH TIES].
        ///     The brackets around X are ommited for Sql8.
        /// </summary>
        /// <param name="writer"> </param>
        /// <param name="sqlGenerator"> </param>
        public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
        {
            writer.Write("TOP ");

            if (sqlGenerator.SqlVersion
                != SqlVersion.Sql8)
            {
                writer.Write("(");
            }

            TopCount.WriteSql(writer, sqlGenerator);

            if (sqlGenerator.SqlVersion
                != SqlVersion.Sql8)
            {
                writer.Write(")");
            }

            writer.Write(" ");

            if (WithTies)
            {
                writer.Write("WITH TIES ");
            }
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:32,代码来源:TopClause.cs

示例5: ExtractColumn

 public ExtractColumn(IDatabaseAdapter src, IDatabaseAdapter dest, ITableConversionRules rules)
 {
     _src = src;
     _dest = dest;
     _rules = rules;
     _destGenerator = new SqlGenerator(_dest);
     _extractedColumns = new List<ExtractedColumn>();
 }
开发者ID:ahaley,项目名称:DatabaseCompiler,代码行数:8,代码来源:ExtractColumn.cs

示例6: WriteSql

        /// <summary>
        /// Write out the SKIP part of sql select statement 
        /// It basically writes SKIP (X).
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="sqlGenerator"></param>
        public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
        {
            writer.Write("SKIP (");
            this.SkipCount.WriteSql(writer, sqlGenerator);
            writer.Write(")");

            writer.Write(" ");
        }
开发者ID:masroore,项目名称:Firebird-NETProvider,代码行数:14,代码来源:SkipClause.cs

示例7: WriteSql

        // <summary>
        // Write out the OFFSET part of sql select statement
        // It basically writes OFFSET X ROWS.
        // </summary>
        public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
        {
            writer.Write("OFFSET ");

            SkipCount.WriteSql(writer, sqlGenerator);

            writer.Write(" ROWS ");
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:12,代码来源:SkipClause.cs

示例8: WriteSql

        /// <summary>
        /// Write out the FIRST part of sql select statement 
        /// It basically writes FIRST (X).
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="sqlGenerator"></param>
        public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
        {
            writer.Write("FIRST (");
            this.FirstCount.WriteSql(writer, sqlGenerator);
            writer.Write(")");

            writer.Write(" ");
        }
开发者ID:masroore,项目名称:Firebird-NETProvider,代码行数:14,代码来源:FirstClause.cs

示例9: About

 public ActionResult About()
 {
             
              
              var filter = new SqlGenerator(SqlGenerator.SqlTypes.Select, "Transact");
              filter.SelectStatementLimit = 1000;
              var baseModel = ModelBase.LoadModel<TransactModel>(filter);
              return View(baseModel.ToList());
             // return View();
 }
开发者ID:emerynt,项目名称:Iris10ReportTesting,代码行数:10,代码来源:HomeController.cs

示例10: ModificationCommandBatchFactory

        public ModificationCommandBatchFactory(
            [NotNull] SqlGenerator sqlGenerator,
            [NotNull] DbContextConfiguration contextConfiguration)
        {
            Check.NotNull(sqlGenerator, "sqlGenerator");
            Check.NotNull(contextConfiguration, "contextConfiguration");

            _sqlGenerator = sqlGenerator;
            _contextConfiguration = contextConfiguration;
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:10,代码来源:ModificationCommandBatchFactory.cs

示例11: WriteSqlIfUsed

 /// <summary>
 ///     Writes that fragment that represents the optional column
 ///     if the usage manager says it is used.
 /// </summary>
 /// <param name="writer"> </param>
 /// <param name="sqlGenerator"> </param>
 public bool WriteSqlIfUsed(SqlWriter writer, SqlGenerator sqlGenerator, string separator)
 {
     if (m_usageManager.IsUsed(m_symbol))
     {
         writer.Write(separator);
         m_builder.WriteSql(writer, sqlGenerator);
         return true;
     }
     return false;
 }
开发者ID:christiandpena,项目名称:entityframework,代码行数:16,代码来源:OptionalColumn.cs

示例12: CreateTableIfNotExists

        public static void CreateTableIfNotExists(this IDao dao, string tableName, Type entityType, params string[] pks)
        {
            //如果表已经存在则跳过
            bool existTable = ExistsTable(dao, tableName);
            if (existTable) {
                return;
            }

            var sqlGen = new SqlGenerator();
            var sql = sqlGen.CreateSqlScript(tableName, entityType, pks);
            dao.Execute(sql);
        }
开发者ID:EaseEasy,项目名称:Ticket,代码行数:12,代码来源:DaoExtensions.Scaffold.cs

示例13: FromTargetConfigs

        private IEnumerable<GeneratorResult> FromTargetConfigs(SqlTargetConfig sqlConfig)
        {
            var args = new GeneratorArguments<SqlTargetConfig>(sqlConfig, AtomsFolder, AtomCreator.LoadDefaults(AtomsFolder));

            var sqlResult = new SqlGenerator().Generate(args);

            sqlResult.OutputPath = sqlConfig.OutputPath;

            if (Directory.Exists(sqlResult.OutputPath))
            {
                foreach (var file in Directory.EnumerateFiles(sqlResult.OutputPath, "*.generated.sql", SearchOption.AllDirectories))
                {
                    sqlResult.Deletions.Add(file);
                }
            }

            string redGateFile = Path.Combine(sqlConfig.OutputPath, "RedGateDatabaseInfo.xml");

            Log.Information("Looking for redgate database info xml at {RedGateDatabaseInfoXml}", redGateFile);

            if (sqlResult.DataFiles.Any() &&
                File.Exists(redGateFile))
            {
                Log.Information("Found redgate file, updating...");

                var regate = XDocument.Load(uri: redGateFile);
                var dataFiles = regate.Root.Elements("DataFileSet").First();
                var allDataFiles = dataFiles.Elements("DataFile")
                                            .Select(n => n.Value).Union(sqlResult.DataFiles, StringComparer.OrdinalIgnoreCase).ToList();

                dataFiles.Elements("Count")
                         .First()
                         .Value = allDataFiles.Count().ToString();

                Log.Information("DataFiles Count: {DataFileCount}", allDataFiles.Count());

                dataFiles.Elements("DataFile").Remove();

                dataFiles.Add(allDataFiles.Select(s => new XElement("DataFile", s)));

                var genResult = new GeneratorResult()
                {
                    OutputPath = _config.OutputPath
                };

                genResult.AddOutput("RedGateDatabaseInfo.xml", regate.ToString());

                yield return genResult;
            }

            yield return sqlResult;
        }
开发者ID:devshorts,项目名称:Atom,代码行数:52,代码来源:SqlVerb.cs

示例14: WriteSql

        /// <summary>
        /// Write out the TOP part of sql select statement 
        /// It basically writes TOP (X) [WITH TIES].
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="sqlGenerator"></param>
        public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
        {
            writer.Write("TOP (");
            this.TopCount.WriteSql(writer, sqlGenerator);
            writer.Write(")");

            writer.Write(" ");

            if (this.WithTies)
            {
                writer.Write("WITH TIES ");
            }
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:19,代码来源:TopClause.cs

示例15: DmlFunctionSqlGenerator

        public DmlFunctionSqlGenerator(DbProviderManifest providerManifest)
        {
            DebugCheck.NotNull(providerManifest);

            var sqlManifest = providerManifest as SqlProviderManifest;

            if (sqlManifest == null)
            {
                throw new ArgumentException(Strings.Mapping_Provider_WrongManifestType(typeof(SqlProviderManifest)));
            }

            _sqlGenerator = new SqlGenerator(sqlManifest.SqlVersion);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:13,代码来源:DmlFunctionSqlGenerator.cs


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