コード例 #1
0
 public DomainObjectConfigCollectionListSource(DomainObjectConfigCollection collection)
 {
     foreach (DomainObjectConfig obj in collection)
     {
         Add(obj);
     }
 }
コード例 #2
0
        public override DomainObjectConfigCollection LoadObject()
        {
            DbCommonCommand command = null;
            IDbCommonDataReader reader = null;

            m_objectConfig = new DomainObjectConfigCollection();

            #region Загрузка объектов
            command = m_loadObjectCommand.Value;

            using (reader = command.ExecuteReader(SessionIdentifier.SHARED_SESSION))
            {
                while (reader.Read())
                {
                    long id = reader.GetValue<long>(0);
                    string code = reader.GetValue<String>(1);
                    string description = reader.GetValue<String>(2);
                    string tableName = reader.GetValue<String>(3);
                    string idField = reader.GetValue<String>(4);
                    string codeName = reader.GetValue<String>(5);

                    DomainObjectConfig configObject = new DomainObjectConfig(id, code, description, tableName, idField, codeName);
                    m_objectConfig.Add(configObject);
                }
                reader.Close();
            }
            #endregion

            #region Загрузка свойств
            command = m_loadPropertyCommand.Value;

            using (reader = command.ExecuteReader(SessionIdentifier.SHARED_SESSION))
            {
                while (reader.Read())
                {
                    long id = reader.GetValue<long>(0);
                    string code = reader.GetValue<String>(1);
                    string description = reader.GetValue<String>(2);
                    string ownerCode = reader.GetValue<String>(3);

                    string dataTypeName = reader.GetValue<String>(4);
                    string assemblyFile = reader.GetValue<String>(5);
                    Type dataType = GetValueType(assemblyFile, dataTypeName);

                    string filedName = reader.GetValue<String>(6);
                    object defaultValue = reader.GetValue(7, typeof(object));
                    int length = reader.GetValue<Int32>(8);
                    string codeName = reader.GetValue<String>(9);

                    DomainObjectConfig owner = m_objectConfig[ownerCode];
                    DomainPropertyConfig property = new DomainPropertyConfig(id, code, description, owner, dataType, filedName, defaultValue, length, codeName);

                    owner.Property.Add(property);
                }
                reader.Close();
            }
            #endregion

            return m_objectConfig;
        }