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


C# Dialect.Dialect类代码示例

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


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


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