database-driven option for setup

Nov 9, 2009 at 5:31 PM
Edited Nov 9, 2009 at 5:33 PM

All -

This is a suggestion.

I wish there were a database-driven option for setup.

This would put the dynamic pages, config, etc, into a database rather than on the file system.

This would be helpful because some deployments do not allow a web app to write to the file system.

(I realize part of the overall intent behind Mwpsk is to make it so it does not need a database for dynamic content, data, etc-- but, in some cases, using a database may be required.)

Thank you.

-- Mark Kamoski

Dec 3, 2009 at 7:24 PM

Hello mkamoski

It can be done, but that will require the whole cms to be rewritten. I have done it (A lot of work :-) ). 
This is a XML driven website, an excellent example of using the XmlSerializer class. 
I really don't think this is a question for this cms.

If you still want to do it , start creating a new Persitable (DataManager) class that reads and write xml to database (Save and read the Serialized xml i database) 
Below is from my project Enterprise.CMS

 public DataManager()
            _data = (T)Activator.CreateInstance(typeof(T));

        public void LoadData()
            SqlConnection Conn = new SqlConnection(Config.ConnectionString());
            string ID = GetID();
            {   //Minimize database calls
                object o= HttpContext.Current.Cache["ModuleData_"+ ID];
                o = null; //dev
                if (o == null)
                    SqlCommand command = new SqlCommand(string.Format("SELECT ObjectData FROM Objects WHERE id={0}", ID), Conn);
                    SqlDataReader dr = command.ExecuteReader();

                    if (dr.Read())
                        _data = (T)Enterprise.Utils.SerializeFactory.DeserializeObject((string)dr["ObjectData"], typeof(T));
                        HttpContext.Current.Cache.Insert("ModuleData_" + ID, _data);
                _data = (T)HttpContext.Current.Cache["ModuleData_" + ID];
            catch (Exception ec) { throw ec; }
            finally { Conn.Close(); }