コード例 #1
0
        public void Save()
        {
            if (this.hasChanges)
            {
                metadata_.SaveState_toFile(
                    filename_
                    );

                haschanges_ = false;
            }
        }
コード例 #2
0
        //#endregion

        #region private Methods...
        #endregion
        //#region public Methods...
        #region public void New(...);
        public void New(
            string applicationPath_in,
            string applicationName_in,
            string namespace_in,
            cDBMetadata_DB[] dbs_in,
            cDBMetadata.dLoadState_fromDB notifyBack_in
            )
        {
            int _justadded;

            if (notifyBack_in != null)
            {
                notifyBack_in("creating...", true);
            }
            #region cDBMetadata _metadata_temp = new cDBMetadata(); ...;
            cDBMetadata _metadata_temp = new cDBMetadata();
            _metadata_temp.ApplicationName = applicationName_in;
            _metadata_temp.Namespace       = namespace_in;
            _metadata_temp.DBs.Clear();
            for (int d = 0; d < dbs_in.Length; d++)
            {
                _justadded = _metadata_temp.DBs.Add(
                    dbs_in[d].DBServerType,
                    false
                    );
                _metadata_temp.DBs[_justadded].CopyFrom(
                    dbs_in[d]
                    );

                //if (d == 0) {
                //    // ToDos: here! document this behaviour and describe it throught unit testing
                //    // first item in the array, represents default db connection
                //    _metadata_temp.Default_DBServerType = _metadata_temp.DBs[_justadded].DBServerType;
                //    _metadata_temp.Default_ConfigMode = _metadata_temp.DBs[_justadded].Connections[0].ConfigMode;
                //}
            }
            _metadata_temp.GUIDDatalayer         = System.Guid.NewGuid().ToString("D").ToUpper();
            _metadata_temp.GUIDDatalayer_UTs     = System.Guid.NewGuid().ToString("D").ToUpper();
            _metadata_temp.GUIDBusinesslayer     = System.Guid.NewGuid().ToString("D").ToUpper();
            _metadata_temp.GUIDBusinesslayer_UTs = System.Guid.NewGuid().ToString("D").ToUpper();
            _metadata_temp.GUIDTest = System.Guid.NewGuid().ToString("D").ToUpper();
            #endregion

            if (notifyBack_in != null)
            {
                notifyBack_in("- generating xml file", true);
            }
            #region string _xmlfile = ...;
            string _xmlfile = string.Format(
                //"{0}{1}OGen-metadatas{1}MD_{2}-{3}.OGen-metadata.xml",
                "{0}{1}OGen-metadatas{1}MD_{2}.OGen-metadata.xml",
                /*0*/ applicationPath_in,
                /*1*/ System.IO.Path.DirectorySeparatorChar,
                /*2*/ applicationName_in

                // first item in the array, represents default db connection
                ///*3*/, dbs_in[0].DBServerType.ToString()
                );
            #endregion
            _metadata_temp.SaveState_toFile(_xmlfile);

            if (notifyBack_in != null)
            {
                notifyBack_in("... finished!", true);
            }
            if (notifyBack_in != null)
            {
                notifyBack_in("", true);
            }

            Open(_xmlfile, true, notifyBack_in);
        }