예제 #1
0
        private static void createMDF(DataType dtype)
        {
            string connectionString;

            switch (dtype)
            {
            case DataType.Annotation:
                connectionString = createConnectionString(ANNOMDFFILENAME);
                using (AnnoDB db = new AnnoDB(connectionString))
                {
                    if (db.DatabaseExists())
                    {
                        db.DeleteDatabase();
                    }
                    db.CreateDatabase();
                }
                break;

            case DataType.Meteorite:
                connectionString = createConnectionString(METEOMDFFILENAME);
                using (MeteoDB db = new MeteoDB(connectionString))
                {
                    if (db.DatabaseExists())
                    {
                        db.DeleteDatabase();
                    }
                    db.CreateDatabase();
                    //db.MeteoTable.InsertOnSubmit(new Meteorite());
                }
                break;

            case DataType.LibObject:
                connectionString = createConnectionString(LIBRARYFILENAME);
                using (LibDB db = new LibDB(connectionString))
                {
                    if (db.DatabaseExists())
                    {
                        db.DeleteDatabase();
                    }
                    db.CreateDatabase();
                }
                break;
            }
        }
예제 #2
0
        internal static object getDataContext(DataType dtype)
        {
            string connectionString;

            switch (dtype)
            {
            case DataType.Annotation:
                connectionString = createConnectionString(ANNOMDFFILENAME);
                AnnoDB db = new AnnoDB(connectionString);
                {
                    if (!db.DatabaseExists())
                    {
                        createMDF(dtype);
                    }
                    return(db);
                }
                break;

            case DataType.Meteorite:
                connectionString = createConnectionString(METEOMDFFILENAME);
                MeteoDB mdb = new MeteoDB(connectionString);
                {
                    if (!mdb.DatabaseExists())
                    {
                        createMDF(dtype);
                    }
                    return(mdb);
                }
                break;

            case DataType.LibObject:
                connectionString = createConnectionString(LIBRARYFILENAME);
                LibDB lib = new LibDB(connectionString);
                {
                    if (!lib.DatabaseExists())
                    {
                        createMDF(dtype);
                    }
                    return(lib);
                }
                break;
            }
            return(null);
        }