Exemplo n.º 1
0
        //public ZebraDBManager()
        //{
        //    if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
        //    {
        //        this.ZebraConfig = ZebraConfig.FromXML("Zebra2.zebraconfig");
        //    }
        //    else this.ZebraConfig = ZebraConfig.FromXML("..\\..\\..\\..\\CoreLibrary\\Zebra2.zebraconfig");



        //    switch (this.ZebraConfig.DatabaseProvider)
        //    {
        //        case DatabaseProvider.MySQL:
        //            this.Context = new MySQLZebraContext(this.ZebraConfig);
        //            break;
        //        case DatabaseProvider.Acces:
        //            throw new NotImplementedException();
        //            break;
        //        case DatabaseProvider.SQLite:
        //            this.Context = new SQLiteZebraContext(this.ZebraConfig);
        //            break;
        //        default:
        //            break;
        //    }

        //    this.Archive = new LocalArchive(ZebraConfig.ArchiveCredentials as LocalArchiveCredentials);
        //    Context.Database.EnsureCreated();
        //}

        public ZebraDBManager(ZebraConfig ZebraConf)
        {
            ZebraConfig = ZebraConf;


            // Setup Context
            switch (ZebraConf.DatabaseProvider)
            {
            case DatabaseProvider.MySQL:
                this.Context = new MySQLZebraContext(ZebraConf);
                break;

            case DatabaseProvider.Acces:
                this.Context = new AccessZebraContext(ZebraConf);
                break;

            case DatabaseProvider.SQLite:
                this.Context = new SQLiteZebraContext(ZebraConf);
                break;

            default:
                throw new Exception("Invalid Database Type in Config File");
            }

            // Setup Archive
            switch (ZebraConf.ArchiveType)
            {
            case ArchiveType.FTP:
                this.Archive = new FTPArchive(ZebraConf.ArchiveCredentials as FTPCredentials);
                break;

            case ArchiveType.SFTP:
                this.Archive = new SFTPArchive(ZebraConf.ArchiveCredentials as SFTPCredentials);
                break;

            case ArchiveType.Local:
                this.Archive = new LocalArchive(ZebraConf.ArchiveCredentials as LocalArchiveCredentials);
                break;

            default:
                throw new Exception("Invalid Archive Type in Config File");
            }
        }
Exemplo n.º 2
0
 public SQLiteZebraContext(ZebraConfig config) : base(config)
 {
 }
Exemplo n.º 3
0
 public ZebraContext(ZebraConfig zebraConfig)
 {
     this.Settings = zebraConfig;
 }
Exemplo n.º 4
0
 public MySQLZebraContext(ZebraConfig config) : base(config)
 {
 }
Exemplo n.º 5
0
 public AccessZebraContext(ZebraConfig config) : base(config)
 {
 }