コード例 #1
0
ファイル: cDBMetadata.cs プロジェクト: katshann/ogen
		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
		}
コード例 #2
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
        }