/// <summary> /// Recupera o nome do provedor associado com o queryinfo informado. /// </summary> /// <param name="queryInfo"></param> /// <returns></returns> public string GetProviderName(Colosoft.Query.QueryInfo queryInfo) { if (queryInfo.StoredProcedureName != null) { return((!string.IsNullOrEmpty(queryInfo.StoredProcedureProvider)) ? queryInfo.StoredProcedureProvider : GDA.GDASettings.DefaultProviderName); } else { var typeMetadata = _typeSchema.GetTypeMetadata(queryInfo.Entities[0].FullName); return(typeMetadata == null ? GDA.GDASettings.DefaultProviderName : typeMetadata.TableName.Catalog); } }
/// <summary> /// Cria o gerador associado com o tipo informado. /// </summary> /// <param name="typeName"></param> /// <returns></returns> public Query.IRecordKeyGenerator CreateGenerator(Colosoft.Reflection.TypeName typeName) { typeName.Require("typeName").NotNull(); Query.IRecordKeyGenerator result = null; var key = typeName.FullName; lock (_generators) if (_generators.TryGetValue(key, out result)) { return(result); } var typeMetadata = _typeSchema.GetTypeMetadata(key); if (typeMetadata == null) { result = new DefaultRecordKeyGenerator(typeName); } else { var keys = typeMetadata.GetKeyProperties().Select(f => f.Name).ToArray(); result = new Generator(typeName, _cultureInfo, keys); } lock (_generators) if (!_generators.ContainsKey(key)) { _generators.Add(key, result); } return(result); }
/// <summary> /// Verifica se existe algum tipo das ações que está é indexado pelo cache. /// </summary> /// <param name="actions"></param> /// <returns></returns> private bool ExistsCacheType(IEnumerable <PersistenceAction> actions) { if (actions == null) { return(false); } foreach (var action in actions) { var typeMetadata = _typeSchema.GetTypeMetadata(action.EntityFullName); if (typeMetadata.IsCache) { return(true); } if (ExistsCacheType(action.AfterActions) || ExistsCacheType(action.BeforeActions) || ExistsCacheType(action.AlternativeActions)) { return(true); } } return(false); }