示例#1
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);
		}
示例#2
0
		public cDBMetadata_Tables(
			iClaSSe aggregateloopback_ref_in, 
			cDBMetadata parent_ref_in
		) : base (
			aggregateloopback_ref_in
		) {
			parent_ref_ = parent_ref_in;

			//#region ClaSSe...
			tables_ = new ArrayList();
			//#endregion
		}
		public cDBMetadata_DBs(
			iClaSSe aggregateloopback_ref_in, 
			cDBMetadata root_ref_in
		) : base (
			aggregateloopback_ref_in
		) {
			root_ref_ = root_ref_in;

			//#region ClaSSe...
			dbs_ = new ArrayList();
			//#endregion
		}
示例#4
0
        public cDBMetadata_Tables(
            iClaSSe aggregateloopback_ref_in,
            cDBMetadata parent_ref_in
            ) : base(
                aggregateloopback_ref_in
                )
        {
            parent_ref_ = parent_ref_in;

            //#region ClaSSe...
            tables_ = new ArrayList();
            //#endregion
        }
示例#5
0
        public cDBMetadata_DBs(
            iClaSSe aggregateloopback_ref_in,
            cDBMetadata root_ref_in
            ) : base(
                aggregateloopback_ref_in
                )
        {
            root_ref_ = root_ref_in;

            //#region ClaSSe...
            dbs_ = new ArrayList();
            //#endregion
        }
示例#6
0
		public void LoadState_fromFile(
			string fileName_in, 
			eMetadata metadata_in
		) {
//			#region ...
			cDBMetadata _xmlFile_metadata;
			switch (metadata_in) {
				case eMetadata.All:
					_xmlFile_metadata = this;
					break;
				case eMetadata.All_butDatabaseER:
					_xmlFile_metadata = new cDBMetadata();
					//_xmlFile_metadata.default_dbservertype_ = default_dbservertype_;
					//_xmlFile_metadata.default_configmode_ = default_configmode_;
					break;
				default:
					throw new Exception("not implemented!");
			}

			_xmlFile_metadata.LoadState_fromFile(fileName_in, root4xml);

			switch (metadata_in) {
				case eMetadata.All:
					#region this = _xmlFile_metadata;
					#endregion
					break;
				case eMetadata.All_butDatabaseER:
//			#endregion

					//---
					ApplicationName			= _xmlFile_metadata.ApplicationName;
					Namespace				= _xmlFile_metadata.Namespace;
					//default_dbservertype_	= _xmlFile_metadata.default_dbservertype_;
					//default_configmode_		= _xmlFile_metadata.default_configmode_;
					PseudoReflectionable	= _xmlFile_metadata.PseudoReflectionable;
					SubAppName				= _xmlFile_metadata.SubAppName;
					SQLScriptOption			= _xmlFile_metadata.SQLScriptOption;
					//guidsolution_			= _xmlFile_metadata.guidsolution_;
					guiddatalayer_			= _xmlFile_metadata.guiddatalayer_;
					guiddatalayer_uts_		= _xmlFile_metadata.guiddatalayer_uts_;
					guidbusinesslayer_		= _xmlFile_metadata.guidbusinesslayer_;
					guidbusinesslayer_uts_	= _xmlFile_metadata.guidbusinesslayer_uts_;
					guidtest_				= _xmlFile_metadata.guidtest_;
					feedbackemailaddress_	= _xmlFile_metadata.feedbackemailaddress_;
					copyrighttext_			= _xmlFile_metadata.copyrighttext_;
					copyrighttextlong_		= _xmlFile_metadata.copyrighttextlong_;
					//---

					dbs_.CopyFrom(
						_xmlFile_metadata.dbs_
					);

					for (int t = 0; t < _xmlFile_metadata.Tables.Count; t++) {
						int _T = tables_.Search(_xmlFile_metadata.Tables[t].Name);
						if (_T != -1) {
							//---
							tables_[_T].FriendlyName = _xmlFile_metadata.Tables[t].FriendlyName;
//							tables_[_T].DBDescription = _xmlFile_metadata.Tables[t].DBDescription;
							tables_[_T].ExtendedDescription = _xmlFile_metadata.Tables[t].ExtendedDescription;
							//---
							tables_[_T].Searches.CopyFrom(
								_xmlFile_metadata.Tables[t].Searches
							);
							//---
							tables_[_T].Updates.CopyFrom(
								_xmlFile_metadata.Tables[t].Updates
							);
							//---
							// USE isVirtualTable FROM DB, NOT XML:
							//tables_[_T].isVirtualTable = _xmlFile_metadata.Tables[t].isVirtualTable;
							tables_[_T].isConfig = _xmlFile_metadata.Tables[t].isConfig;
							//---

							for (int f = 0; f < _xmlFile_metadata.Tables[t].Fields.Count; f++) {
								int _F = tables_[_T].Fields.Search(_xmlFile_metadata.Tables[t].Fields[f].Name);
								if (_F != -1) {
									//---
									tables_[_T].Fields[_F].FriendlyName = _xmlFile_metadata.Tables[t].Fields[f].FriendlyName;
//									tables_[_T].Fields[_F].DBDescription = _xmlFile_metadata.Tables[t].Fields[f].DBDescription;
//									tables_[_T].Fields[_F].DBDefaultValue = _xmlFile_metadata.Tables[t].Fields[f].DBDefaultValue;
									tables_[_T].Fields[_F].ExtendedDescription = _xmlFile_metadata.Tables[t].Fields[f].ExtendedDescription;
									tables_[_T].Fields[_F].AditionalInfo = _xmlFile_metadata.Tables[t].Fields[f].AditionalInfo;
									//---
									tables_[_T].Fields[_F].isListItemText = _xmlFile_metadata.Tables[t].Fields[f].isListItemText;
									tables_[_T].Fields[_F].isListItemValue = _xmlFile_metadata.Tables[t].Fields[f].isListItemValue;
									//---
									tables_[_T].Fields[_F].DefaultValue = _xmlFile_metadata.Tables[t].Fields[f].DefaultValue;
									//---
									if (tables_[_T].isVirtualTable) {
										tables_[_T].Fields[_F].isIdentity = _xmlFile_metadata.Tables[t].Fields[f].isIdentity;
										tables_[_T].Fields[_F].isPK = _xmlFile_metadata.Tables[t].Fields[f].isPK;

										tables_[_T].Fields[_F].FK_TableName = _xmlFile_metadata.Tables[t].Fields[f].FK_TableName;
										tables_[_T].Fields[_F].FK_FieldName = _xmlFile_metadata.Tables[t].Fields[f].FK_FieldName;
									}
									//---
									tables_[_T].Fields[_F].isConfig_Name = _xmlFile_metadata.Tables[t].Fields[f].isConfig_Name;
									tables_[_T].Fields[_F].isConfig_Config = _xmlFile_metadata.Tables[t].Fields[f].isConfig_Config;
									tables_[_T].Fields[_F].isConfig_Datatype = _xmlFile_metadata.Tables[t].Fields[f].isConfig_Datatype;
									//---
									//...
									//---
								} else {
//NotifyBase(string.Format("HEY! someone changed field:{0}.{1} and I've lost it's ListItems", xmlFile_metadata.Tables[t].Name, xmlFile_metadata.Tables[t].Fields[f].Name));
								}
							}
						} else {
//NotifyBase(string.Format("HEY! someone changed table:{0} and I've lost it's Searches", xmlFile_metadata.Tables[t].Name));
						}
					}

			#region ...
					break;
				default:
					throw new Exception("not implemented!");
			}
			#endregion
		}
示例#7
0
//		#region public void Open(...);
		public void Open(
			string filename_in, 
			bool force_doNOTsave_in, 
			cDBMetadata.dLoadState_fromDB notifyBack_in
		) {
			#region Checking...
			if (this.hasChanges) {
				if (!force_doNOTsave_in) {
					throw new Exception(string.Format("{0}.{1}.Open(): - must save before open", this.GetType().Namespace, this.GetType().Name));
				}
			}
			#endregion
			filename_ = filename_in;

			if (notifyBack_in != null) notifyBack_in("opening...", true);
			#region cDBMetadata _metadata_temp = new cDBMetadata().LoadState_fromFile(filename_);
			if (notifyBack_in != null) notifyBack_in("- reading configuration from xml file", true);
			cDBMetadata _metadata_temp = new cDBMetadata();
			_metadata_temp.LoadState_fromFile(
				filename_, 
				cDBMetadata.eMetadata.All
			);
			#endregion
//			#region metadata_.LoadState_fromDB(...);
			if (notifyBack_in != null) notifyBack_in("- reading metadata from db", true);
			metadata_ = new cDBMetadata();

// ToDos: here!
metadata_.Tables.Clear();
for (int d = 0; d < _metadata_temp.DBs.Count; d++) {
	for (int c = 0; c < _metadata_temp.DBs[d].Connections.Count; c++) {
		if (_metadata_temp.DBs[d].Connections[c].GenerateSQL) {
			//_metadata_temp.DBs[d].Connections[c].Connectionstring
			metadata_.LoadState_fromDB(
				(notifyBack_in != null) 
					? new cDBMetadata.dLoadState_fromDB(
						notifyBack_in
					) 
					: null,
				_metadata_temp.DBs[d].DBServerType,
				_metadata_temp.DBs[d].Connections[c].Connectionstring, 
				_metadata_temp.SubAppName, 
				false
			);

		}
	}
}
			//metadata_.LoadState_fromDB(
			//    (notifyBack_in != null) 
			//        ? new cDBMetadata.dLoadState_fromDB(
			//            notifyBack_in
			//        ) 
			//        : null, 
			//    _metadata_temp.Default_DBServerType, 
			//    _metadata_temp.Default_Connectionstring(), 
			//    _metadata_temp.SubAppName
			//);
//			#endregion
			#region metadata_.LoadState_fromFile(filename_, All_butDatabaseER);
			if (notifyBack_in != null) notifyBack_in("- updating metadata with xml file", true);
			metadata_.LoadState_fromFile(
				filename_, 
				cDBMetadata.eMetadata.All_butDatabaseER
			);
			#endregion
			if (notifyBack_in != null) notifyBack_in("... finished", true);
		}
示例#8
0
        public void LoadState_fromFile(
            string fileName_in,
            eMetadata metadata_in
            )
        {
//			#region ...
            cDBMetadata _xmlFile_metadata;

            switch (metadata_in)
            {
            case eMetadata.All:
                _xmlFile_metadata = this;
                break;

            case eMetadata.All_butDatabaseER:
                _xmlFile_metadata = new cDBMetadata();
                //_xmlFile_metadata.default_dbservertype_ = default_dbservertype_;
                //_xmlFile_metadata.default_configmode_ = default_configmode_;
                break;

            default:
                throw new Exception("not implemented!");
            }

            _xmlFile_metadata.LoadState_fromFile(fileName_in, root4xml);

            switch (metadata_in)
            {
            case eMetadata.All:
                #region this = _xmlFile_metadata;
                #endregion
                break;

            case eMetadata.All_butDatabaseER:
//			#endregion

                //---
                ApplicationName = _xmlFile_metadata.ApplicationName;
                Namespace       = _xmlFile_metadata.Namespace;
                //default_dbservertype_	= _xmlFile_metadata.default_dbservertype_;
                //default_configmode_		= _xmlFile_metadata.default_configmode_;
                PseudoReflectionable = _xmlFile_metadata.PseudoReflectionable;
                SubAppName           = _xmlFile_metadata.SubAppName;
                SQLScriptOption      = _xmlFile_metadata.SQLScriptOption;
                //guidsolution_			= _xmlFile_metadata.guidsolution_;
                guiddatalayer_         = _xmlFile_metadata.guiddatalayer_;
                guiddatalayer_uts_     = _xmlFile_metadata.guiddatalayer_uts_;
                guidbusinesslayer_     = _xmlFile_metadata.guidbusinesslayer_;
                guidbusinesslayer_uts_ = _xmlFile_metadata.guidbusinesslayer_uts_;
                guidtest_             = _xmlFile_metadata.guidtest_;
                feedbackemailaddress_ = _xmlFile_metadata.feedbackemailaddress_;
                copyrighttext_        = _xmlFile_metadata.copyrighttext_;
                copyrighttextlong_    = _xmlFile_metadata.copyrighttextlong_;
                //---

                dbs_.CopyFrom(
                    _xmlFile_metadata.dbs_
                    );

                for (int t = 0; t < _xmlFile_metadata.Tables.Count; t++)
                {
                    int _T = tables_.Search(_xmlFile_metadata.Tables[t].Name);
                    if (_T != -1)
                    {
                        //---
                        tables_[_T].FriendlyName = _xmlFile_metadata.Tables[t].FriendlyName;
//							tables_[_T].DBDescription = _xmlFile_metadata.Tables[t].DBDescription;
                        tables_[_T].ExtendedDescription = _xmlFile_metadata.Tables[t].ExtendedDescription;
                        //---
                        tables_[_T].Searches.CopyFrom(
                            _xmlFile_metadata.Tables[t].Searches
                            );
                        //---
                        tables_[_T].Updates.CopyFrom(
                            _xmlFile_metadata.Tables[t].Updates
                            );
                        //---
                        // USE isVirtualTable FROM DB, NOT XML:
                        //tables_[_T].isVirtualTable = _xmlFile_metadata.Tables[t].isVirtualTable;
                        tables_[_T].isConfig = _xmlFile_metadata.Tables[t].isConfig;
                        //---

                        for (int f = 0; f < _xmlFile_metadata.Tables[t].Fields.Count; f++)
                        {
                            int _F = tables_[_T].Fields.Search(_xmlFile_metadata.Tables[t].Fields[f].Name);
                            if (_F != -1)
                            {
                                //---
                                tables_[_T].Fields[_F].FriendlyName = _xmlFile_metadata.Tables[t].Fields[f].FriendlyName;
//									tables_[_T].Fields[_F].DBDescription = _xmlFile_metadata.Tables[t].Fields[f].DBDescription;
//									tables_[_T].Fields[_F].DBDefaultValue = _xmlFile_metadata.Tables[t].Fields[f].DBDefaultValue;
                                tables_[_T].Fields[_F].ExtendedDescription = _xmlFile_metadata.Tables[t].Fields[f].ExtendedDescription;
                                tables_[_T].Fields[_F].AditionalInfo       = _xmlFile_metadata.Tables[t].Fields[f].AditionalInfo;
                                //---
                                tables_[_T].Fields[_F].isListItemText  = _xmlFile_metadata.Tables[t].Fields[f].isListItemText;
                                tables_[_T].Fields[_F].isListItemValue = _xmlFile_metadata.Tables[t].Fields[f].isListItemValue;
                                //---
                                tables_[_T].Fields[_F].DefaultValue = _xmlFile_metadata.Tables[t].Fields[f].DefaultValue;
                                //---
                                if (tables_[_T].isVirtualTable)
                                {
                                    tables_[_T].Fields[_F].isIdentity = _xmlFile_metadata.Tables[t].Fields[f].isIdentity;
                                    tables_[_T].Fields[_F].isPK       = _xmlFile_metadata.Tables[t].Fields[f].isPK;

                                    tables_[_T].Fields[_F].FK_TableName = _xmlFile_metadata.Tables[t].Fields[f].FK_TableName;
                                    tables_[_T].Fields[_F].FK_FieldName = _xmlFile_metadata.Tables[t].Fields[f].FK_FieldName;
                                }
                                //---
                                tables_[_T].Fields[_F].isConfig_Name     = _xmlFile_metadata.Tables[t].Fields[f].isConfig_Name;
                                tables_[_T].Fields[_F].isConfig_Config   = _xmlFile_metadata.Tables[t].Fields[f].isConfig_Config;
                                tables_[_T].Fields[_F].isConfig_Datatype = _xmlFile_metadata.Tables[t].Fields[f].isConfig_Datatype;
                                //---
                                //...
                                //---
                            }
                            else
                            {
//NotifyBase(string.Format("HEY! someone changed field:{0}.{1} and I've lost it's ListItems", xmlFile_metadata.Tables[t].Name, xmlFile_metadata.Tables[t].Fields[f].Name));
                            }
                        }
                    }
                    else
                    {
//NotifyBase(string.Format("HEY! someone changed table:{0} and I've lost it's Searches", xmlFile_metadata.Tables[t].Name));
                    }
                }

                #region ...
                break;

            default:
                throw new Exception("not implemented!");
            }
            #endregion
        }