mikependon / RepoDB

A hybrid ORM library for .NET.
Apache License 2.0
1.7k stars 125 forks source link

Enhancement: Introduce the ApplicationContext class. #1085

Closed mikependon closed 1 year ago

mikependon commented 2 years ago

Describe the enhancement

Introduce the application configuration class that allow the users to define the generalized and globalized values for the library.

Reading values:

var isAutomaticConversion = ApplicationContext.Get<bool>("WhateverKey");

if (isAutomaticConversion)
{
     ...
}

Setting values:

ApplicationContext.Set("WhateverKey", "WhateverValue");

Additional Context

In general, this class can be utilized in any means, regardless of scenarios/use-cases. As a recommendation, the usual properties used by the application must be held by this class. See the Constant class properties (i.e.: DefaultBatchOperationSize and DefaultCacheItemExpirationInMinutes) and/or the Converter class properties (i.e.: ConversionType and EnumDefaultDatabaseType).

mikependon commented 2 years ago

Referencing #1087

mikependon commented 2 years ago

I considered this initiative as invalid. The purpose of an ORM is to solve the hydration/push operations for the object/data via the proper mappings and not for giving a facility of defining the application behavior.

ngardon commented 1 year ago

This is currently invalid and up for grabs at the same time.

Which is it please ?

And if it is up for grabs, I'll need more context as to what exactly is expected.

mikependon commented 1 year ago

I think, this has been fixed by this already, in our last release. Link: https://repodb.net/class/globalconfiguration

mikependon commented 1 year ago

This has been marked invalid at the later stage due to its design as not aligned to the actual implementation.