Пример #1
0
        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;
        }
Пример #2
0
        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);
        }
Пример #3
0
 public static LiteStorage FileDb(this PublicContext ctx)
 {
     return(GetDb(ctx).FileStorage);
 }
Пример #4
0
 public static LiteQueryable <T> As <T>(this PublicContext ctx)
 {
     return(GetDb(ctx).Query <T>());
 }
Пример #5
0
 public static LiteRepository GetDb(this PublicContext ctx)
 {
     return(Data.I.GetRepository(ctx));
 }