public SqlExpression(ISqlDialectProvider dialectProvider) { _dialectProvider = dialectProvider; _sqlContext = new SqlClauseContext(); modelDef = typeof(T).GetModelDefinition(); _sqlContext.From = " FROM " + modelDef.Name; }
/// <summary> /// 获得类型的列名 /// </summary> /// <param name="obj"></param> /// <returns></returns> private static string GetColmons(ISqlDialectProvider sqlProvider, IClassMapper mapper) { if (mapper == null) { return(string.Empty); } return(string.Join(", ", mapper.Properties.Select(p => FormatNameWithChar(sqlProvider, p.ColumnName)).ToList())); }
public static ISqlDialectProvider GetSqlProvider(string name) { var connection = ConfigurationManager.ConnectionStrings[name]; ISqlDialectProvider provider = null; ProviderDictionary.TryGetValue(connection.ProviderName, out provider); return(provider); }
/// <summary> /// 获得值 /// </summary> /// <param name="obj"></param> /// <returns></returns> private static string GetValues(object obj, ISqlDialectProvider sqlProvider, IClassMapper mapper) { if (obj == null) { return(string.Empty); } return(string.Join(", ", mapper.Properties.Select(p => string.Format("{0}", sqlProvider.FormatValue(p.PropertyInfo.GetValue(obj), true, p.PropertyInfo.PropertyType))).ToArray())); }
public Database(string name) { Connection = DatabaseConfiguration.GetConnection(name); DialectProvider = DatabaseConfiguration.GetSqlProvider(name); if (Connection.State != ConnectionState.Open) { Connection.Open(); } }
public MySqlExpression(ISqlDialectProvider dialectProvider) : base(dialectProvider) { }
public SqlServerExpression(ISqlDialectProvider dialectProvider) : base(dialectProvider) { }
private static string FormatNameWithChar(ISqlDialectProvider sqlProvider, string value) { return(sqlProvider.OpenQuote + value + sqlProvider.CloseQuote); }
public SqlEntityAdapter(Database database, ISqlDialectProvider dialectProvider) { Database = database; DialectProvider = dialectProvider; }
public SqlLanguageProviderHelper(IObjectAccesor objectAccesor, ISqlDialectProvider dialectProvider) { _objectAccesor = objectAccesor; _dialectProvider = dialectProvider; }