Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Satellite class to use the same Factory/Locator across application modules #69

Open
abughuffa opened this issue Nov 3, 2021 · 0 comments

Comments

@abughuffa
Copy link

abughuffa commented Nov 3, 2021

hi sire.

good morning,

here,, I'm trying to use your code in modular wpf application based on GeminiWpf "By Tim Jones", to share Factory/Locator across modules, I have created this class to insure that all module uses the same Factory/Locator.

please take a few minutes to verify the class code.

did I need to dispose it?

public abstract class DataAccess
{
// private properties to hold Factory/Locator
private static IDbContextScopeFactory dbContextScopeFactory { get; set; }
private static IAmbientDbContextLocator ambientDbContextLocator { get; set; }

    // public properties to create or retrieve and hold Factory/Locator
    public static IDbContextScopeFactory DbContextScopeFactory
    {
        get
        {
            return dbContextScopeFactory is null ?
                   dbContextScopeFactory = new DbContextScopeFactory() : dbContextScopeFactory;
        }
    }

    public static IAmbientDbContextLocator AmbientDbContextLocator
    {
        get
        {
            return ambientDbContextLocator is null ?
                   ambientDbContextLocator = new AmbientDbContextLocator() : ambientDbContextLocator;
        }
    }
}

and thank you for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant