public AppDataConnection(string spName) { if (_conn == null || _conn.State == ConnectionState.Closed) { _conn = LocalDBHelper.GetLocalDB(LocalDBHelper.DB_DEFAULT_NAME, false); } InitCommand(spName); }
internal static void Init() { bool exists = false; SqlConnection conn = LocalDBHelper.GetLocalDB(LocalDBHelper.DB_DEFAULT_NAME, out exists, false); if (!exists) { var initCommands = AssetsHelper.GetEmbededResourceSql("initDatabase"); foreach (var initCommand in initCommands.Split(new string[] { "GO" }, StringSplitOptions.RemoveEmptyEntries)) { var command = conn.CreateCommand(); command.CommandText = initCommand; command.ExecuteNonQuery(); } } conn.Close(); }
public LocalDBDao() : base(LocalDBHelper.GetInstance()) { }