Skip to content

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

@abughuffa

Description

@abughuffa

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions