Web.Config, Client.cfg

Desde el BLOG de Enrique Almeida


 Funcionalidades de GeneXus que conviene conocer: ConfigurationManager external object

El external object ConfigurationManager, viene nativo en el modulo GeneXus. 

Que se puede hacer con esto?

Es para poder recuperar un valor de una propiedad del client.cfg,  web.config o CloudServices.config
Por ejemplo, si queremos ver que formato de fecha se esa utilizando en el web.config, desde un programa, podemos hacer:

if ConfigurationManager.HasValue("DateFormat")
     Msg(ConfigurationManager.GetValue("DateFormat"),status)
endif


y la salida va a ser

DMY

pues en el web.config tengo la entrada

    <add key="DateFormat" value="DMY" />


Los métodos tienen un segundo parámetro opcional, que permite leer de un archivo de configuración especifico, por si queremos crearnos nuestro propio archivo de configuración. 

Es muy util para hacer objetos que dependan de características de los archivos de configuración. 

Usar este external object, evita el usar codigo java o .net para leer los archivos de configuración y hacen mucho mas facil  las futuras migraciones. 

Ademas la solucion GeneXus se puede pasar de .NET a Java sin tener que hacer adaptaciones, quedando mejor situada para ser multiplataforma. 
--
Saludos,
gab
@gxsoft

ConfigurationManager external object
Official Content
This documentation is valid for:

The ConfigurationManager external object allows you to read the application configuration at runtime.
This means that you have a way to access the configuration that is being used at runtime and has been set in environment variables (only the variables explained in this document) or configuration files (a.k.a. web.config, client.cfg., CloudServices.config).

pick1_2018727141336_1_pngpick2_201872714145_1_png

Methods

HasValue 

Returns true if the property has a value set.
The parameter filename is optional. If it is not set, a valid property is one that is set in the standard configuration files (web.config / client.cfg or CloudServices.config) or an environment variable.

Return valueBoolean data type
ParameterspropName:VarChar [  fileName:VarChar ]

GetValue

Returns the value set in the property.
The parameter filename is optional. If it is not set, the property must be one that is set in the standard configuration files (web.config / client.cfg or CloudServices.config) or an environment variable.

Return valueVarChar
ParameterspropName:VarChar [  fileName:VarChar ]

 

Notes

In both methods, the name of the property is instantiated as it is in the web.config or client.cfg. If you require a property of another file, either from the CloudServices.config file or from your own, the name of the property must be prefixed with the service type separated by a colon (:). eg: Notifications: APP_ID.

If a file is specified, the format of this file must be similar to the CloudServices.config and the way to choose the value of a property is the same as in the case of the CloudServices.config (<ServiceType>:<propName>)

As of GeneXus 16 Upgrade 7, services from the same type can appear more than once. That's the case of the Chatbot type where every property is saved under a Chatbot instance identified by the Conversational Flows name. So in that case you should get the property with the following format <ServiceType>:<ServiceName>:<propName>,

Sample Configuration file:

<?xml version="1.0" encoding="utf-8"?>  <Services>    <Service>      <Name>MyServiceName</Name>      <Type>MyServiceType</Type>      <ClassName>MyServiceClass</ClassName>      <Properties>        <Property>          <Name>Property1</Name>          <Value>Value of Property 1</Value>        </Property>        <Property>          <Name>Property2</Name>          <Value>Value of Property 2</Value>        </Property>      </Properties>    </Service>  </Services>

To get the value of Property1, write the following:

&FileName = !"MyConfigFile.config"  &propName = !"MyServiceType:Property1"  if ConfigurationManager.HasValue(&propName, &FileName)     msg(ConfigurationManager.GetValue(&propName, &FileName))  else     msg("Property has not been set")  endif

Availability

Configuration Manager is available as of GeneXus 15 upgrade 12.

See also



--
Has recibido este mensaje porque estás suscrito al grupo "GeneXus" de Grupos de Google.
Para cancelar la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a genexus+unsubscribe@googlegroups.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/genexus/CAEogB3Rz9trPTVUGUC9JqWG83Rs6em%3DMqvaEXka5kBjtsnpQLg%40mail.gmail.com.

Seu Gmail está quase sem espaço de armazenamento

                                                                                                                                                                                              
Aumente seu armazenamento agora para não deixar de enviar ou receber e-mails quando atingir o limite
 ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  ‌ ‌ ‌ ‌ ‌ ‌
Você está quase sem espaço de armazenamento e talvez não receba novos e-mails
88% cheio 15 GB
Você está usando 13,27 GB (88%) dos 15 GB de armazenamento disponíveis na sua Conta do Google. Por isso, está quase sem espaço no Gmail, Google Drive e Google Photos. Quando você atingir o limite, talvez não seja possível enviar e receber e-mails na conta do Gmail. Para evitar interrupções, faça uma assinatura do Google One e aumente o armazenamento. Planos a partir de R$ 6,99 por mês.
Ainda não quer aumentar o armazenamento?
Exclua arquivos para liberar espaço.
Saiba mais sobre o Google One ou acesse nossa Central de Ajuda para conhecer as opções de armazenamento.
Desconsidere este e-mail se você já tiver tomado as medidas necessárias.
 
Este e-mail foi útil?
 
Este aviso obrigatório de serviço por e-mail contém informações importantes sobre sua Conta do Google.
© 2021 Google LLC
1600 Amphitheatre Parkway,
Mountain View, CA 94043