public static T Query <T>(this IDynamicVault vault, string vaultKey, Func <T> createFactory = null) { T result = default(T); object vaultData; var key = typeof(T).FullName + vaultKey; if (vault.Query(key, out vaultData)) { result = (T)vaultData; return(result); } if (createFactory != null) { result = createFactory(); } vault.Store(key, result); return(result); }
public SandboxClient(DomainAssemblyResolver assemblyResolver, IExplorer explorer) { if (assemblyResolver == null) { throw new ArgumentNullException(nameof(assemblyResolver)); } if (explorer == null) { throw new ArgumentNullException(nameof(explorer)); } _assemblyResolver = assemblyResolver; _explorer = explorer; _dynamicVault = new DynamicVault(); _nugetExplorer = new NugetExplorer(_explorer.Directories[BuildDirectory.Solution]); _macroResolver = new MacroResolver(); _macroResolver.Register(new ExplorerMacroHandler(_explorer)); _macroResolver.Register(new NugetExplorerMacroHandler(_nugetExplorer)); _macroResolver.Register(new EnvironmentMacroHandler()); _macroResolver.Register(new TimeMacroHandler()); _macroResolver.Register(new UidMacroHandler()); _macroResolver.Register(new SpecialDirectoryMacroHandler()); }
public static T Store <T>(this IDynamicVault vault, string vaultKey, T value) { return((T)vault.Store(typeof(T).FullName + vaultKey, value)); }
public static T Store <T>(this IDynamicVault vault, T value) { return(vault.Store <T>(null, value)); }
public static T Query <T>(this IDynamicVault vault, Func <T> createFactory = null) { return(vault.Query <T>(null, createFactory)); }