• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Dialect.Dialect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GenerateDataDefintionLanguage

        public IEnumerable<string> GenerateDataDefintionLanguage(Dialect dialect)
        {
            var formatter = new DdlFormatter();

            foreach (var s in _versioningStrategy.EnsureDbObjectsStatements)
            {
                if (!String.IsNullOrWhiteSpace(s))
                {
                    yield return formatter.Format(s).TrimEnd();

                }
            }
            foreach (var m in _migrations)
            {
                foreach (var o in m.Operations)
                {
                    foreach (var s in o.GetStatements(dialect))
                    {
                        if (!String.IsNullOrWhiteSpace(s))
                        {
                            yield return formatter.Format(s).TrimEnd();
                        }
                    }
                }
                var updateVersionStatements = _versioningStrategy.GetUpdateVersionStatements(m.Version, m.Context);
                foreach (var s in updateVersionStatements)
                {
                    if (!String.IsNullOrWhiteSpace(s))
                    {
                        yield return formatter.Format(s).TrimEnd();
                    }
                }
            }
        }
开发者ID:jeffreyabecker,项目名称:NHMigrations,代码行数:34,代码来源:MigrationExecutor.cs


示例2: Configure

 /// <inheritdoc/>
 public void Configure(IType type, IDictionary<string, string> parms, Dialect dialect)
 {
     if (!parms.TryGetValue(IdGenFunctionNameParam, out _idGenFunctionName))
         _idGenFunctionName = DefaultIdGenFunctionName;
     _targetTableName = parms[TargetTableNameParam];
     _targetTableIdColumnName = parms[TargetTableIdColumnNameParam];
 }
开发者ID:FubarDevelopment,项目名称:Lexware,代码行数:8,代码来源:LexwareIdTableGenerator.cs


示例3: SqlDropString

 public override string SqlDropString(Dialect dialect,
     string defaultCatalog, string defaultSchema)
 {
     FinalizeAuditTable((IExtendedDialect)dialect);
       return auditTable.SqlDropString(dialect,
     defaultCatalog, defaultSchema);
 }
开发者ID:michelelepri,项目名称:uNhAddIns,代码行数:7,代码来源:AuditTable.cs


示例4: SessionSource

        public SessionSource(FluentConfiguration config)
        {
            configuration = config.Configuration;

            sessionFactory = config.BuildSessionFactory();
            dialect = Dialect.GetDialect(configuration.Properties);
        }
开发者ID:HudsonAkridge,项目名称:fluent-nhibernate,代码行数:7,代码来源:SessionSource.cs


示例5: Renderer

		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="config"></param>
        protected Renderer(Configuration config)
		{
            _config = config;
			_dialect = Dialect.GetDialect(config.Properties);
            _defaultSchema = config.GetProperty(NHibernate.Cfg.Environment.DefaultSchema);

		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:11,代码来源:Renderer.cs


示例6: SqlCreateString

 public override string SqlCreateString(Dialect dialect,
     IMapping p, string defaultCatalog, string defaultSchema)
 {
     FinalizeAuditTable((IExtendedDialect) dialect);
       return auditTable.SqlCreateString(
     dialect, p, defaultCatalog, defaultSchema);
 }
开发者ID:michelelepri,项目名称:uNhAddIns,代码行数:7,代码来源:AuditTable.cs


示例7: SqlTriggerBody

        public override string SqlTriggerBody(
      Dialect dialect, IMapping p, 
      string defaultCatalog, string defaultSchema)
        {
            var auditTableName = dialect.QuoteForTableName(_auditTableName);
              var eDialect = (IExtendedDialect)dialect;

              string triggerSource = _action == TriggerActions.DELETE ?
            eDialect.GetTriggerOldDataAlias() :
            eDialect.GetTriggerNewDataAlias();

              var columns = new List<string>(_dataColumnNames);
              columns.AddRange(from ac in _auditColumns
                       select ac.Name);

              var values = new List<string>();
              values.AddRange(
            from columnName in _dataColumnNames
            select eDialect.QualifyColumn(
              triggerSource, columnName));
              values.AddRange(
            from auditColumn in _auditColumns
            select auditColumn.ValueFunction.Invoke(_action));

              return eDialect.GetInsertIntoString(auditTableName,
            columns, triggerSource, values);
        }
开发者ID:akhuang,项目名称:NHibernate,代码行数:27,代码来源:AuditTrigger.cs


示例8: Configure

		/// <summary>
		/// Configures the TableGenerator by reading the value of <c>table</c>, 
		/// <c>column</c>, and <c>schema</c> from the <c>parms</c> parameter.
		/// </summary>
		/// <param name="type">The <see cref="IType"/> the identifier should be.</param>
		/// <param name="parms">An <see cref="IDictionary"/> of Param values that are keyed by parameter name.</param>
		/// <param name="dialect">The <see cref="Dialect"/> to help with Configuration.</param>
		public virtual void Configure(IType type, IDictionary<string, string> parms, Dialect.Dialect dialect)
		{
			tableName = PropertiesHelper.GetString(TableParamName, parms, DefaultTableName);
			columnName = PropertiesHelper.GetString(ColumnParamName, parms, DefaultColumnName);
			whereClause = PropertiesHelper.GetString(Where, parms, "");
			string schemaName = PropertiesHelper.GetString(PersistentIdGeneratorParmsNames.Schema, parms, null);
			string catalogName = PropertiesHelper.GetString(PersistentIdGeneratorParmsNames.Catalog, parms, null);

			if (tableName.IndexOf('.') < 0)
			{
				tableName = dialect.Qualify(catalogName, schemaName, tableName);
			}

			var selectBuilder = new SqlStringBuilder(100);
			selectBuilder.Add("select " + columnName)
				.Add(" from " + dialect.AppendLockHint(LockMode.Upgrade, tableName));
			if (string.IsNullOrEmpty(whereClause) == false)
			{
				selectBuilder.Add(" where ").Add(whereClause);
			}
			selectBuilder.Add(dialect.ForUpdateString);

			query = selectBuilder.ToString();

			columnType = type as PrimitiveType;
			if (columnType == null)
			{
				log.Error("Column type for TableGenerator is not a value type");
				throw new ArgumentException("type is not a ValueTypeType", "type");
			}

			// build the sql string for the Update since it uses parameters
			if (type is Int16Type)
			{
				columnSqlType = SqlTypeFactory.Int16;
			}
			else if (type is Int64Type)
			{
				columnSqlType = SqlTypeFactory.Int64;
			}
			else
			{
				columnSqlType = SqlTypeFactory.Int32;
			}

			parameterTypes = new[] {columnSqlType, columnSqlType};

			var builder = new SqlStringBuilder(100);
			builder.Add("update " + tableName + " set ")
				.Add(columnName).Add(" = ").Add(Parameter.Placeholder)
				.Add(" where ")
				.Add(columnName).Add(" = ").Add(Parameter.Placeholder);
			if (string.IsNullOrEmpty(whereClause) == false)
			{
				builder.Add(" and ").Add(whereClause);
			}

			updateSql = builder.ToSqlString();
		}
开发者ID:tkellogg,项目名称:NHibernate3-withProxyHooks,代码行数:66,代码来源:TableGenerator.cs


示例9: GetSqlType

 public static string GetSqlType(this Column column, Dialect dialect)
 {
     if (!String.IsNullOrWhiteSpace(column.SqlType))
     {
         return column.SqlType;
     }
     return dialect.GetTypeName(column.SqlTypeCode);
 }
开发者ID:jeffreyabecker,项目名称:NHMigrations,代码行数:8,代码来源:MappingExtensions.cs


示例10: Configure

        /// <summary>
        /// Configures the specified type.
        /// </summary>
        /// <param name="type">The type to configure.</param>
        /// <param name="parms">The parameters.</param>
        /// <param name="dialect">The dialect.</param>
        public override void Configure( IType type, IDictionary<string, string> parms, Dialect dialect )
        {
            parms[TableParamName] = "HiValue";
            parms[ColumnParamName] = "HiValueKey";
            parms[MaxLo] = "1000";
            parms["schema"] = "CommonModule";

            base.Configure ( type, parms, dialect );
        }
开发者ID:divyang4481,项目名称:REM,代码行数:15,代码来源:CustomTableHiLoGenerator.cs


示例11: ColumnInfo

		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="column"></param>
		/// <param name="config"></param>
		/// <param name="dialect"></param>
		internal ColumnInfo(Column column, Configuration config, Dialect dialect)
		{
			_name = column.Name;
			_nullable = column.IsNullable;
			_sqlType = column.GetSqlType(dialect, new Mapping(config));

            //as of NH2.0, the length column seems to be set at 255 for non-string-like columns, which makes no sense
            //therefore ignore NH length for non-string like columns, and use -1 which corresponds to the pre-2.0 behaviour
            _length = (this.SqlType.IndexOf("char", System.StringComparison.InvariantCultureIgnoreCase) > -1) ? column.Length : -1;
        }
开发者ID:nhannd,项目名称:Xian,代码行数:16,代码来源:ColumnInfo.cs


示例12: Initialize

        protected void Initialize(Configuration nhibernateConfig, PersistenceModel model)
        {
            if( model == null ) throw new ArgumentNullException("model", "Model cannot be null");

            Configuration = nhibernateConfig;

            model.Configure(Configuration);

            SessionFactory = Configuration.BuildSessionFactory();
            dialect = Dialect.GetDialect(Configuration.Properties);
        }
开发者ID:nsreddy1986,项目名称:fluent-nhibernate,代码行数:11,代码来源:SessionSource.cs


示例13: AppliesTo

		protected override bool AppliesTo(Dialect.Dialect dialect)
		{
			if (dialect is MySQLDialect)
				return false;
			if (dialect is InformixDialect)
				return false;
			if (dialect is SQLiteDialect)
				return false;

			return true;
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:11,代码来源:FullJoinTest.cs


示例14: Configure

		/// <summary>
		/// Configures the TableGenerator by reading the value of <c>table</c>, 
		/// <c>column</c>, and <c>schema</c> from the <c>parms</c> parameter.
		/// </summary>
		/// <param name="type">The <see cref="IType"/> the identifier should be.</param>
		/// <param name="parms">An <see cref="IDictionary"/> of Param values that are keyed by parameter name.</param>
		/// <param name="dialect">The <see cref="Dialect"/> to help with Configuration.</param>
		public virtual void Configure(IType type, IDictionary parms, Dialect.Dialect dialect)
		{
			tableName = PropertiesHelper.GetString(Table, parms, "hibernate_unique_key");
			columnName = PropertiesHelper.GetString(Column, parms, "next_hi");
			string schemaName = (string) parms[Schema];
			if (schemaName != null && tableName.IndexOf(StringHelper.Dot) < 0)
			{
				tableName = schemaName + "." + tableName;
			}

			query =
				"select " +
				columnName +
				" from " +
				dialect.AppendLockHint(LockMode.Upgrade, tableName) +
				dialect.ForUpdateString;

			columnType = type as ValueTypeType;
			if (columnType == null)
			{
				log.Error("Column type for TableGenerator is not a value type");
				throw new ArgumentException("type is not a ValueTypeType", "type");
			}

			// build the sql string for the Update since it uses parameters
			if (type is Int16Type)
			{
				columnSqlType = SqlTypeFactory.Int16;
			}
			else if (type is Int64Type)
			{
				columnSqlType = SqlTypeFactory.Int64;
			}
			else
			{
				columnSqlType = SqlTypeFactory.Int32;
			}

			parameterTypes = new SqlType[2] {columnSqlType, columnSqlType};

			SqlStringBuilder builder = new SqlStringBuilder();
			builder.Add("update " + tableName + " set ")
				.Add(columnName)
				.Add(" = ")
				.Add(Parameter.Placeholder)
				.Add(" where ")
				.Add(columnName)
				.Add(" = ")
				.Add(Parameter.Placeholder);

			updateSql = builder.ToSqlString();
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:59,代码来源:TableGenerator.cs


示例15: SqlCreateString

        public override string SqlCreateString(Dialect dialect, IMapping p, string defaultCatalog, string defaultSchema)
        {
            IExtendedDialect eDialect = (IExtendedDialect) dialect;

              var buf = new StringBuilder();

              buf.AppendLine(eDialect.GetCreateTriggerHeaderString(
            _triggerName, _tableName, _action));

              buf.AppendLine(SqlTriggerBody(dialect, p, defaultCatalog, defaultSchema));

              buf.AppendLine(eDialect.GetCreateTriggerFooterString(
            _triggerName, _tableName, _action));

              return buf.ToString();
        }
开发者ID:akhuang,项目名称:NHibernate,代码行数:16,代码来源:Trigger.cs


示例16: ExecuteMigrationScript

 public void ExecuteMigrationScript(Dialect dialect, TextWriter log = null)
 {
     log = log ?? new StringWriter();
     using (var s = _sessionFactory.OpenStatelessSession())
     {
         var conn = s.Connection;
         foreach (var statement in GenerateDataDefintionLanguage(dialect))
         {
             log.WriteLine(statement);
             using (var cmd = conn.CreateCommand())
             {
                 cmd.CommandText = statement;
                 cmd.CommandType = CommandType.Text;
             }
         }
     }
 }
开发者ID:jeffreyabecker,项目名称:NHMigrations,代码行数:17,代码来源:MigrationExecutor.cs


示例17: AppliesTo

		protected override bool AppliesTo(Dialect.Dialect dialect)
		{
			// It seems that SQLite has a nasty bug with coalesce

			// Following query does not work
			//    SELECT order0_.*
			//    FROM   Orders order0_ 
			//    WHERE  coalesce(order0_.Freight, 0) > @p0;

			// And this one works
			//    SELECT order0_.*
			//    FROM   Orders order0_ 
			//    WHERE  cast(coalesce(order0_.Freight, 0) as NUMERIC) > @p0;

			if (dialect is SQLiteDialect)
				return false;
			return base.AppliesTo(dialect);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:18,代码来源:GetValueOrDefaultTests.cs


示例18: AppliesTo

		protected override bool AppliesTo(Dialect.Dialect dialect)
		{
			var typeNames = (TypeNames)typeof(Dialect.Dialect).GetField("_typeNames", ReflectHelper.AnyVisibilityInstance).GetValue(Dialect);
			try
			{
				var value = AppliesTo();

				if (value == null) return true;
				
				typeNames.Get(value.Value);
			}
			catch (ArgumentException)
			{
				return false;
			}
			catch (Exception)
			{
				Assert.Fail("Probably a bug in the test case.");
			}

			return true;
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:22,代码来源:FixtureBase.cs


示例19: SqlDropString

 /// <summary>
 /// The SQL required to remove the underlying database objects for a TableGenerator.
 /// </summary>
 /// <param name="dialect">The <see cref="Dialect"/> to help with creating the sql.</param>
 /// <returns>
 /// A <see cref="String"/> that will drop the database objects for the TableGenerator.
 /// </returns>
 public string SqlDropString(Dialect.Dialect dialect)
 {
     return dialect.GetDropTableString(tableName);
 }
开发者ID:zibler,项目名称:zibler,代码行数:11,代码来源:TableGenerator.cs


示例20: SqlCreateStrings

 /// <summary>
 /// The SQL required to create the database objects for a TableGenerator.
 /// </summary>
 /// <param name="dialect">The <see cref="Dialect"/> to help with creating the sql.</param>
 /// <returns>
 /// An array of <see cref="String"/> objects that contain the Dialect specific sql to 
 /// create the necessary database objects and to create the first value as <c>1</c> 
 /// for the TableGenerator.
 /// </returns>
 public string[] SqlCreateStrings(Dialect.Dialect dialect)
 {
     // changed the first value to be "1" by default since an uninitialized Int32 is 0 - leaving
     // it at 0 would cause problems with an unsaved-value="0" which is what most people are
     // defaulting <id>'s with Int32 types at.
     return new string[]
         {
             "create table " + tableName + " ( " + columnName + " " + dialect.GetTypeName(columnSqlType) + " )",
             "insert into " + tableName + " values ( 1 )"
         };
 }
开发者ID:zibler,项目名称:zibler,代码行数:20,代码来源:TableGenerator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DomainModel.Bar类代码示例发布时间:2022-05-26
下一篇:
C# Collection.List类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap