Esempio n. 1
0
 public AppDataConnection(string spName)
 {
     if (_conn == null || _conn.State == ConnectionState.Closed)
     {
         _conn = LocalDBHelper.GetLocalDB(LocalDBHelper.DB_DEFAULT_NAME, false);
     }
     InitCommand(spName);
 }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
 public LocalDBDao()
     : base(LocalDBHelper.GetInstance())
 {
 }