public ServerContext(string configPath, IMessenger m) { if (Testing != null) { throw new Exception(nameof(ServerContext) + " is already initialised in this app domain."); } if (string.IsNullOrWhiteSpace(configPath)) { throw new ArgumentException($"\'{nameof(configPath)}\' cannot be empty."); } Config = PrimeServerConfig.Get(Path.GetFullPath(configPath)); M = m; Users = new Users(this); Public = new PublicContext(this); Testing = this; }
public ServerContext(string configPath, IMessenger m) { configPath = configPath.ResolveSpecial(); PlatformCurrent = OsInformation.GetPlatform(); _testing = this; //todo: hack for now. if (string.IsNullOrWhiteSpace(configPath)) { throw new ArgumentException($"\'{nameof(configPath)}\' cannot be empty."); } Assemblies = new AssemblyCatalogue(); Types = new TypeCatalogue(Assemblies); ConfigDirectoryInfo = new FileInfo(Path.GetFullPath(configPath)).Directory; Config = PrimeServerConfig.Get(Path.GetFullPath(configPath)); M = m; Users = new Users(this); Public = new PublicContext(this); }
public static LiteStorage FileDb(this PublicContext ctx) { return(GetDb(ctx).FileStorage); }
public static LiteQueryable <T> As <T>(this PublicContext ctx) { return(GetDb(ctx).Query <T>()); }
public static LiteRepository GetDb(this PublicContext ctx) { return(Data.I.GetRepository(ctx)); }