Esempio n. 1
0
        /// <summary>
        /// Gets an existing database or creates a new one.
        /// </summary>
        /// <param name="name">The name of the database to get or create.</param>
        /// <param name="database">The database.</param>
        /// <returns>true if the database was opened, false if it was created.</returns>
        public static bool Get(string name, out Database database)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (name == String.Empty)
            {
                throw new ArgumentException("name");
            }

            //Try to open or create the database
            database = null;
            try
            {
                database = Get(Open.open(name, Context));
                return(true);
            }
            catch (Exception)
            {
                try
                {
                    database = Get(CreateDB.create(name, Parser.emptyParser(Context.prop), Context));
                    return(false);
                }
                catch (Exception ex)
                {
                    throw new ArgumentException("Could not create database.", ex);
                }
            }
        }
Esempio n. 2
0
        public ActionResult Connect(ConnectionString model)
        {
            ////ilk açılış cache'i tetikledik
            //CreateCache.Create();
            ////we are updating connection string on web.config
            var updatedResult = UpdateConfig.update(model.connectionString);

            CreateDB.create();
            CreateCache.Create();
            //return RedirectToAction("Product", "Index");
            return(RedirectToAction("List", "Home"));
        }