68 lines
1.3 KiB
C#
Raw Normal View History

2025-05-18 01:04:31 +08:00
// ***********************************************************************
// Assembly : Unity
// Author : Kimch
// Created :
//
// Last Modified By : Kimch
// Last Modified On :
// ***********************************************************************
// <copyright file= "Database" company=""></copyright>
// <summary></summary>
// ***********************************************************************
using System;
using System.Collections.Generic;
using G;
public class Database
{
private string _name;
private Archive _archive;
public string name
{
get { return _name; }
}
public Archive archive
{
get { return _archive; }
}
private Database(string name)
{
_name = name;
_archive = Archive.Create(name);
}
public static Database Create(string name)
{
return new Database(name);
}
#region
private Dictionary<string, Table> _tables = new Dictionary<string, Table>();
public Table CreateTable(Schema schema)
{
if (_tables.ContainsKey(schema.name))
{
throw new InvalidOperationException(string.Format("Table '{0}' is exists", schema.name));
}
var table = new Table(this, schema);
_tables[table.name] = table;
return table;
}
public Table GetTable(string name)
{
return _tables[name];
}
#endregion
#region
#endregion
}