static bool TryGetCastTargetDbTypeString(Type sourceType, Type targetType, out string dbTypeString, bool throwNotSupportedException = true) { dbTypeString = null; sourceType = ReflectionExtension.GetUnderlyingType(sourceType); targetType = ReflectionExtension.GetUnderlyingType(targetType); if (sourceType == targetType) return false; if (targetType == UtilConstants.TypeOfDecimal) { //Casting to Decimal is not supported when missing the precision and scale information.I have no idea to deal with this case now. if (sourceType != UtilConstants.TypeOfInt16 && sourceType != UtilConstants.TypeOfInt32 && sourceType != UtilConstants.TypeOfInt64 && sourceType != UtilConstants.TypeOfByte) { if (throwNotSupportedException) throw new NotSupportedException(AppendNotSupportedCastErrorMsg(sourceType, targetType)); else return false; } } if (CastTypeMap.TryGetValue(targetType, out dbTypeString)) { return true; } if (throwNotSupportedException) throw new NotSupportedException(AppendNotSupportedCastErrorMsg(sourceType, targetType)); else return false; }
static bool TryGetCastTargetDbTypeString(Type sourceType, Type targetType, out string dbTypeString, bool throwNotSupportedException = true) { dbTypeString = null; sourceType = ReflectionExtension.GetUnderlyingType(sourceType); targetType = ReflectionExtension.GetUnderlyingType(targetType); if (sourceType == targetType) { return(false); } if (CastTypeMap.TryGetValue(targetType, out dbTypeString)) { return(true); } if (throwNotSupportedException) { throw new NotSupportedException(AppendNotSupportedCastErrorMsg(sourceType, targetType)); } else { return(false); } }
public virtual void TrackEntity(object entity) { Utils.CheckNull(entity); Type entityType = entity.GetType(); if (ReflectionExtension.IsAnonymousType(entityType)) { return; } Dictionary <Type, TrackEntityCollection> entityContainer = this.TrackingEntityContainer; TrackEntityCollection collection; if (!entityContainer.TryGetValue(entityType, out collection)) { TypeDescriptor typeDescriptor = EntityTypeContainer.GetDescriptor(entityType); if (!typeDescriptor.HasPrimaryKey()) { return; } collection = new TrackEntityCollection(typeDescriptor); entityContainer.Add(entityType, collection); } collection.TryAddEntity(entity); }
static DbParam[] BuildParams(IDbContext dbContext, object parameter) { List <DbParam> parameters = new List <DbParam>(); if (parameter != null) { string parameterPrefix = GetParameterPrefix(dbContext); Type parameterType = parameter.GetType(); var props = parameterType.GetProperties(); foreach (var prop in props) { if (prop.GetGetMethod() == null) { continue; } object value = ReflectionExtension.GetMemberValue(prop, parameter); string paramName = parameterPrefix + prop.Name; DbParam p = new DbParam(paramName, value, prop.PropertyType); parameters.Add(p); } } return(parameters.ToArray()); }
public static DbParam[] BuildParams(DbContext dbContext, object parameter) { if (parameter == null) { return(new DbParam[0]); } if (parameter is IEnumerable <DbParam> ) { return(((IEnumerable <DbParam>)parameter).ToArray()); } List <DbParam> parameters = new List <DbParam>(); Type parameterType = parameter.GetType(); var props = parameterType.GetProperties(); foreach (var prop in props) { if (prop.GetGetMethod() == null || !MappingTypeSystem.IsMappingType(prop.GetMemberType())) { continue; } object value = ReflectionExtension.GetMemberValue(prop, parameter); string paramName = dbContext.DatabaseProvider.CreateParameterName(prop.Name); DbParam p = new DbParam(paramName, value, prop.PropertyType); parameters.Add(p); } return(parameters.ToArray()); }
public override DbExpression Visit(DbMemberExpression exp) { MemberInfo member = exp.Member; if (member.DeclaringType == UtilConstants.TypeOfDateTime) { if (member == UtilConstants.PropertyInfo_DateTime_Now) { this._sqlBuilder.Append("GETDATE()"); return(exp); } if (member == UtilConstants.PropertyInfo_DateTime_UtcNow) { this._sqlBuilder.Append("GETUTCDATE()"); return(exp); } if (member == UtilConstants.PropertyInfo_DateTime_Today) { this.BuildCastState("GETDATE()", "DATE"); return(exp); } if (member == UtilConstants.PropertyInfo_DateTime_Date) { this.BuildCastState(exp.Expression, "DATE"); return(exp); } if (this.IsDatePart(exp)) { return(exp); } } if (member.Name == "Length" && member.DeclaringType == UtilConstants.TypeOfString) { this._sqlBuilder.Append("LEN("); exp.Expression.Accept(this); this._sqlBuilder.Append(")"); return(exp); } if (member.Name == "Value" && ReflectionExtension.IsNullable(exp.Expression.Type)) { exp.Expression.Accept(this); return(exp); } DbParameterExpression newExp; if (DbExpressionExtension.TryConvertToParameterExpression(exp, out newExp)) { return(newExp.Accept(this)); } throw new NotSupportedException(string.Format("'{0}.{1}' is not supported.", member.DeclaringType.FullName, member.Name)); }
public static MemberValueGetter CreateValueGetter(MemberInfo propertyOrField) { ParameterExpression p = Expression.Parameter(typeof(object), "a"); Expression instance = null; if (!propertyOrField.IsStaticMember()) { instance = Expression.Convert(p, propertyOrField.DeclaringType); } var memberAccess = Expression.MakeMemberAccess(instance, propertyOrField); Type type = ReflectionExtension.GetMemberType(propertyOrField); Expression body = memberAccess; if (type.IsValueType) { body = Expression.Convert(memberAccess, typeof(object)); } var lambda = Expression.Lambda <MemberValueGetter>(body, p); MemberValueGetter ret = lambda.Compile(); return(ret); }
/// <summary> /// Prepares the proxy. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="proxyOptions">The proxy options.</param> private static void PrepareProxy <T>(AopProxyOptions proxyOptions) where T : class { if (proxyOptions != null) { var type = typeof(T); var typeName = string.Format("{0}AopProxy", type.Name); try { //var aopAttribute = type.GetCustomAttribute<BaseAOPAttribute>(true); //proxyOptions.MethodInjectionDelegates = aopAttribute?.MethodInjectionDelegates ?? proxyOptions.MethodInjectionDelegates; var generator = new AopProxyGenerator <T>(string.Format(ProxyNamespaceFormat, type.Namespace), typeName); var code = generator.GenerateCode(); code.CheckEmptyString(nameof(code)); TempAssemblyProvider assemblyProvider = new TempAssemblyProvider(); assemblyProvider.CreateTempAssembly(code.AsArray(), TempAssemblyProvider.GetCurrentAppDomainAssemblyLocations()); proxyOptions.ProxiedType = ReflectionExtension.SmartGetType(typeName); } catch (Exception ex) { throw new Beyova.Diagnostic.InitializationFailureException(typeName, ex, minor: "AopProxyGeneration", data: new { type = type?.FullName }); } } }
static void Main(string[] args) { try { var path = GetFilePath(fileName); var mlContext = new MLContext(seed: 0); Console.WriteLine($"Reading data from path: {path}"); var dataView = mlContext.Data.LoadFromTextFile <AlcoholData>(path, hasHeader: true, separatorChar: ','); Console.WriteLine("Completed reading data from file \n"); Console.WriteLine("Trasformation of data \n"); var names = ReflectionExtension.GetParameterNames(typeof(AlcoholData)); var feature = names[0]; var dataColumns = names.Where(x => x != feature).ToArray(); var pipeline = mlContext.Transforms .Conversion.MapValueToKey(feature) .Append(mlContext.Transforms.Concatenate("Features", dataColumns)) .AppendCacheCheckpoint(mlContext) .Append(mlContext.MulticlassClassification.Trainers.StochasticDualCoordinateAscent(labelColumnName: feature, featureColumnName: "Features")) .Append(mlContext.Transforms.Conversion.MapKeyToValue("PredictedLabel")); Console.WriteLine("Create prediction model"); var model = pipeline.Fit(dataView); Console.WriteLine("Prediction of model"); Console.ReadKey(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void CollectMethods() { var attributes = ReflectionExtension.GetMethodAttributesFrom(ContextType).ToList(); _pathOptions = attributes.Select(a => new GUIContent(a.Alias, a.Help)).ToArray(); _methods = attributes.Select(a => a.Name).ToArray(); }
public static void Aggregate_Average(SqlGenerator generator, DbExpression exp, Type retType) { string targetDbType = null; Type underlyingType = ReflectionExtension.GetUnderlyingType(retType); if (underlyingType != exp.Type.GetUnderlyingType()) { CastTypeMap.TryGetValue(underlyingType, out targetDbType); } generator._sqlBuilder.Append("AVG", "("); if (string.IsNullOrEmpty(targetDbType)) { exp.Accept(generator); } else { generator._sqlBuilder.Append("CAST("); exp.Accept(generator); generator._sqlBuilder.Append(" AS ", targetDbType, ")"); } generator._sqlBuilder.Append(")"); }
/// <summary> /// When the ObjectPtr points to nothing, this method generates the objects that can be created by default /// </summary> /// <param name="self">Self.</param> /// <param name="names">Names.</param> /// <param name="functions">Functions.</param> private void GenerateTypeCreationList(Component self, out string[] names, out SelectNextObjectFunction[] functions) { List <string> list = new List <string>(); List <SelectNextObjectFunction> list_of_data = new List <SelectNextObjectFunction>(); string[] theList = GetNamespacesForNewComponentOptions(); if (theList != null) { for (int i = 0; i < theList.Length; ++i) { string namespaceName = theList[i]; possibleResponses = System.Reflection.Assembly.GetExecutingAssembly().GetTypesInNamespace(namespaceName); list.AddRange(ReflectionExtension.TypeNamesWithoutNamespace(possibleResponses, namespaceName)); for (int t = 0; t < possibleResponses.Length; t++) { System.Type nextT = possibleResponses[t]; list_of_data.Add(() => { return(CreateSelectedClass(nextT, self)); }); } } } list.Insert(0, (theList != null) ? "<-- select Object or create..." : "<-- select Object"); list_of_data.Insert(0, null); names = list.ToArray(); functions = list_of_data.ToArray(); }
public static Type CreateMRMType(MemberInfo propertyOrField) { Type entityType = propertyOrField.DeclaringType; Assembly assembly = entityType.GetAssembly(); ModuleBuilder moduleBuilder; if (!_moduleBuilders.TryGetValue(assembly, out moduleBuilder)) { lock (assembly) { if (!_moduleBuilders.TryGetValue(assembly, out moduleBuilder)) { var assemblyName = new AssemblyName(String.Format(CultureInfo.InvariantCulture, "ChloeMRMs-{0}", assembly.FullName)); assemblyName.Version = new Version(1, 0, 0, 0); AssemblyBuilder assemblyBuilder; #if NETCORE assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run); #elif NETFX assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run); #endif moduleBuilder = assemblyBuilder.DefineDynamicModule("ChloeMRMModule"); _moduleBuilders.Add(assembly, moduleBuilder); } } } TypeAttributes typeAttributes = TypeAttributes.Class | TypeAttributes.NotPublic | TypeAttributes.Sealed; TypeBuilder tb = moduleBuilder.DefineType(string.Format("Chloe.Mapper.MRMs.{0}_{1}_{2}", entityType.Name, propertyOrField.Name, Guid.NewGuid().ToString("N").Substring(0, 5) + System.Threading.Interlocked.Increment(ref _sequenceNumber).ToString()), typeAttributes, null, new Type[] { typeof(IMRM) }); tb.DefineDefaultConstructor(MethodAttributes.Public | MethodAttributes.SpecialName); MethodBuilder methodBuilder = tb.DefineMethod("Map", MethodAttributes.Public | MethodAttributes.Virtual, CallingConventions.HasThis, typeof(void), new Type[] { typeof(object), typeof(IDataReader), typeof(int) }); ILGenerator il = methodBuilder.GetILGenerator(); int parameStartIndex = 1; il.Emit(OpCodes.Ldarg_S, parameStartIndex); //将第一个参数 object 对象加载到栈顶 il.Emit(OpCodes.Castclass, propertyOrField.DeclaringType); //将 object 对象转换为强类型对象 此时栈顶为强类型的对象 var readerMethod = DataReaderConstant.GetReaderMethod(ReflectionExtension.GetMemberType(propertyOrField)); //ordinal il.Emit(OpCodes.Ldarg_S, parameStartIndex + 1); //加载参数DataReader il.Emit(OpCodes.Ldarg_S, parameStartIndex + 2); //加载 read ordinal il.EmitCall(OpCodes.Call, readerMethod, null); //调用对应的 readerMethod 得到 value reader.Getxx(ordinal); 此时栈顶为 value EmitHelper.SetValueIL(il, propertyOrField); // object.XX = value; 此时栈顶为空 il.Emit(OpCodes.Ret); // 即可 return Type t = tb.CreateType(); return(t); }
protected void BreedAndMutate(GameObject other) { var th = other.GetComponent <CommonAnimal>(); // Stop moving movement.isStopped = true; // It's costly to reproduce, proportional to animal age health.ChangeHealth(-reproductionLifeLoss * (1 + Age / 100)); // Spawning a child around // var p = (transform.position + Random.insideUnitSphere * 10).AboveGround(); var childHost = HostManager.instance.SpawnAnimal(transform.position, Quaternion.identity); if (childHost == null) { Debug.LogError($"Reproduce couldn't spawn animal"); return; } // Decrease target life now if (other != null) { other.GetComponent <Health>().ChangeHealth(-reproductionLifeLoss); } else { Debug.LogWarning($"Partner died while breeding"); } var r = ReflectionExtension.GetRange(GetType(), nameof(initialLife)); childHost.initialLife = Mathf.Clamp(Mutate(initialLife, th.initialLife, 1f), r.min, r.max); r = ReflectionExtension.GetRange(GetType(), nameof(initialSpeed)); childHost.initialSpeed = Mathf.Clamp(Mutate(initialSpeed, th.initialSpeed, 1f), r.min, r.max); r = ReflectionExtension.GetRange(GetType(), nameof(randomMovementRange)); childHost.randomMovementRange = Mathf.Clamp(Mutate(randomMovementRange, th.randomMovementRange, 1f), r.min, r.max); r = ReflectionExtension.GetRange(GetType(), nameof(sightRange)); childHost.sightRange = Mathf.Clamp(Mutate(sightRange, th.sightRange, 1f), r.min, r.max); r = ReflectionExtension.GetRange(GetType(), nameof(eatRange)); childHost.eatRange = Mathf.Clamp(Mutate(eatRange, th.eatRange, 1f), r.min, r.max); r = ReflectionExtension.GetRange(GetType(), nameof(metabolism)); childHost.metabolism = Mathf.Clamp(Mutate(metabolism, th.metabolism, 1f), r.min, r.max); r = ReflectionExtension.GetRange(GetType(), nameof(robustness)); childHost.robustness = Mathf.Clamp(Mutate(robustness, th.robustness, 1f), r.min, r.max); // go.GetComponent<MeshFilter>().mesh.Mutation(); // TODO: the new host should have its memes tweaked by meme controller (mutation ...) LastBreed = Time.time; }
public void ResolveType() { var type = ReflectionExtension.ResolveType("Wikiled.Common.Tests.Reflection.ReflectionExtensionTests, Wikiled.Common.Tests"); Assert.AreSame(GetType(), type); type = ReflectionExtension.ResolveType("Wikiled.Common.Tests.Reflection.ReflectionExtensionTests, Wikiled.Common.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); Assert.AreSame(GetType(), type); }
static DbExpression Trim_Nullable_Value(DbExpression exp) { DbMemberExpression memberExp = exp as DbMemberExpression; if (memberExp == null) return exp; if (memberExp.Member.Name == "Value" && ReflectionExtension.IsNullable(memberExp.Expression.Type)) return memberExp.Expression; return exp; }
static string GetTypeName(Type type) { Type underlyingType; if (ReflectionExtension.IsNullable(type, out underlyingType)) { return(string.Format("Nullable<{0}>", GetTypeName(underlyingType))); } return(type.Name); }
private static void CSharpExtensions() { // ClassExtention.Example(); // FuncOrActionOrEventExtension.Example(); // GenericExtention.Example(); // IEnumerableExtension.Example(); // IOExtension.Example(); OOPExtension.Example(); ReflectionExtension.Example(); StringExtention.Example(); }
private static void BuildCache() { var senderMethodName = ReflectionExtension.GetMethodName <Client>(x => x.SendQuery(null)); var senderMethod = typeof(Client) .GetMethods() .Single(m => m.Name == senderMethodName && m.IsGenericMethodDefinition); queryHandlers = ReflectionExtension.ListDescendants <Query>() .Select(t => new QueryInfo(senderMethod, t)) .ToDictionary(qi => qi.Type, qi => qi); }
/// <summary> /// Get top 10 players /// </summary> /// <returns></returns> public List <Rank> GetTopTen() { string assemblyPath = Path.Combine(ReflectionExtension.GetExecutingAssemblyPath(), @"ranking.json"); List <Rank> result = null; using (StreamReader r = new StreamReader(assemblyPath)) { string json = r.ReadToEnd(); result = JsonConvert.DeserializeObject <List <Rank> >(json); result.Sort(); } return(result.Take(10).ToList()); }
public override Query <T> Paging(int pageIndex, int pageSize, Expression <Func <T, object> > sort_field = null, string sortWay = null, Expression <Func <T, object> > sort_field1 = null, string sortWay1 = null) { pageIndex = pageIndex <= 0 ? 1 : pageIndex; var PagingSql = new StringBuilder(); string sort_str = sort_field == null ? string.Empty : $" ORDER BY {ReflectionExtension.GetProperty(sort_field).Name} {sortWay}"; PagingSql.Append(sort_str); sort_str = sort_field1 == null ? string.Empty : $" ,{ReflectionExtension.GetProperty(sort_field1).Name} {sortWay1}"; PagingSql.Append(sort_str); PagingSql.Append($" LIMIT { (pageIndex - 1) * pageSize},{pageSize}"); _sqlPaging = new SqlPaging(PagingSql.ToString()); return(this); }
/// <summary> /// Gets the type of the assembly. /// </summary> /// <returns>List<Type>.</returns> private static List <Type> GetAssemblyType() { List <Type> result = new List <Type>(); foreach (var assembly in ReflectionExtension.GetAppDomainAssemblies()) { foreach (var one in assembly.GetTypes()) { var apiContractAttribute = one.GetCustomAttribute <ApiContractAttribute>(true); if (apiContractAttribute != null) { result.Add(one); } } } return(result); }
/// <summary> /// Write list of player to ranking.json file /// </summary> /// <param name="input"></param> private void WriteToFile(List <Rank> input) { string assemblyPath = Path.Combine(ReflectionExtension.GetExecutingAssemblyPath(), @"ranking.json"); JArray a = new JArray( input.Select(p => new JObject { { "Player", p.Player }, { "TimeRange", p.TimeRange }, { "PlayedTime", p.PlayedTime } }) ); // write JSON directly to a file using (StreamWriter file = File.CreateText(assemblyPath)) using (JsonTextWriter writer = new JsonTextWriter(file)) { a.WriteTo(writer); } }
public async Task <ServiceResponse <TResult> > GetData <TResult>(HttpResponseMessage response) where TResult : IApiResponse { string responseBody = default; try { responseBody = response.Content == null ? null : await response.Content.ReadAsStringAsync().ConfigureAwait(false); TResult result = default; var type = typeof(TResult); if (!string.IsNullOrEmpty(responseBody) && response.IsSuccessStatusCode) { if (!resolutionCache.TryGetValue(type, out var resultType)) { var genericTypes = type.GenericTypeArguments; if (genericTypes.Length != 1) { throw new ArgumentOutOfRangeException(nameof(TResult), "RawResponse<T> is supported"); } resultType = type.GenericTypeArguments[0]; resolutionCache[type] = resultType; } var data = resultType.IsPrimitive() ? ReflectionExtension.ConvertTo(resultType, responseBody) : JsonSerializer.Deserialize(responseBody, resultType, ProtocolSettings.SerializerOptions); result = (TResult)Activator.CreateInstance(type, response.StatusCode, data); } return(ServiceResponse <TResult> .CreateResponse(response, responseBody, result)); } catch (Exception e) { throw new ServiceException(response, responseBody, e); } }
public static Func <object, object> CreateValueGetter(MemberInfo propertyOrField) { var p = Expression.Parameter(typeof(object), "a"); var instance = Expression.Convert(p, propertyOrField.DeclaringType); var memberAccess = Expression.MakeMemberAccess(instance, propertyOrField); Type type = ReflectionExtension.GetMemberType(propertyOrField); Expression body = memberAccess; if (type.IsValueType) { body = Expression.Convert(memberAccess, typeof(object)); } var lambda = Expression.Lambda <Func <object, object> >(body, p); Func <object, object> ret = lambda.Compile(); return(ret); }
public DotNetType(Type type) { IsArray = type.IsArray; if (IsArray) { type = type.GetElementType(); } IsGeneric = type.IsGenericType; if (IsGeneric) { Name = ReflectionExtension.GetGenericTypeName(type.GetGenericTypeDefinition().FullName); GenericTypeArguments = (from item in type.GetGenericArguments() select new DotNetType(item)).ToArray(); } else { Name = type.FullName; GenericTypeArguments = new DotNetType[0]; } }
void Init() { ConstructorInfo constructor = this.ConstructorInfo; Type type = constructor.DeclaringType; if (ReflectionExtension.IsAnonymousType(type)) { ParameterInfo[] parameters = constructor.GetParameters(); this.MemberParameterMap = new Dictionary <MemberInfo, ParameterInfo>(parameters.Length); foreach (ParameterInfo parameter in parameters) { PropertyInfo prop = type.GetProperty(parameter.Name); this.MemberParameterMap.Add(prop, parameter); } } else { this.MemberParameterMap = new Dictionary <MemberInfo, ParameterInfo>(0); } }
private static void DoAddComponent2Prefab() { var pathStr = EditorPrefs.GetString("AutoGenUIPrefabPath"); if (string.IsNullOrEmpty(pathStr)) { return; } EditorPrefs.DeleteKey("AutoGenUIPrefabPath"); Debug.Log(">>>>>>>SerializeUIPrefab: " + pathStr); var uiPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(pathStr); SetObjectRef2Property(uiPrefab, uiPrefab.name, ReflectionExtension.GetAssemblyCSharp()); Debug.Log(">>>>>>>Success Serialize UIPrefab: " + uiPrefab.name); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
private static void SerializeUIPrefab() { string pathStr = EditorPrefs.GetString("AutoGenerateUIPrefabPath"); if (string.IsNullOrEmpty(pathStr)) { return; } EditorPrefs.DeleteKey("AutoGenerateUIPrefabPath"); Assembly assembly = ReflectionExtension.GetAssemblyCSharp(); string[] paths = pathStr.Split(new[] { ';' }, System.StringSplitOptions.RemoveEmptyEntries); bool displayProgress = paths.Length > 3; if (displayProgress) { EditorUtility.DisplayProgressBar("", "Serialize UIPrefab...", 0); } for (var i = 0; i < paths.Length; i++) { GameObject uiPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(paths[i]); AttachSerializeObj(uiPrefab, uiPrefab.name, assembly); if (displayProgress) { EditorUtility.DisplayProgressBar("", "Serialize UIPrefab..." + uiPrefab.name, (float)(i + 1) / paths.Length); } } if (displayProgress) { EditorUtility.ClearProgressBar(); } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
static void AppendAggregateFunction(SqlGenerator generator, DbExpression exp, Type retType, string functionName, bool withCast) { string dbTypeString = null; if (withCast == true) { Type underlyingType = ReflectionExtension.GetUnderlyingType(retType); if (underlyingType != UtilConstants.TypeOfDecimal/* We don't know the precision and scale,so,we can not cast exp to decimal,otherwise maybe cause problems. */ && CastTypeMap.TryGetValue(underlyingType, out dbTypeString)) { generator._sqlBuilder.Append("CAST("); } } generator._sqlBuilder.Append(functionName, "("); exp.Accept(generator); generator._sqlBuilder.Append(")"); if (dbTypeString != null) { generator._sqlBuilder.Append(" AS ", dbTypeString, ")"); } }