Exemplo n.º 1
0
 /// <summary>
 /// Cria um novo atributo de tabela.
 /// </summary>
 /// <param name="name">Nome da tabela.</param>
 /// <param name="name">Nome do banco de dados em que a tabela se encontra</param>
 public Table(string name, string databaseName = null, InheritanceMode inheritanceMode = InheritanceMode.UniqueTable, string parentTableReferenceColumn = null)
 {
     Name                       = name;
     DatabaseName               = databaseName;
     InheritanceMode            = inheritanceMode;
     ParentTableReferenceColumn = parentTableReferenceColumn;
 }
Exemplo n.º 2
0
        internal void ReadXml(XmlNode xmlNode, RdcTreeNode node, ICollection <string> errors)
        {
            InheritanceMode result = InheritSettingsType.Mode;

            if (result != InheritanceMode.Disabled)
            {
                try
                {
                    string value = xmlNode.Attributes["inherit"].Value;
                    if (!Enum.TryParse(value, out result))
                    {
                        errors.Add("Unexpected inheritance mode '{0}' in {1}".InvariantFormat(value, xmlNode.GetFullPath()));
                        result = InheritanceMode.None;
                    }
                }
                catch
                {
                    errors.Add("No inheritance mode specified in {0}".InvariantFormat(xmlNode.GetFullPath()));
                    result = InheritanceMode.None;
                }
                InheritSettingsType.Mode = result;
            }
            switch (result)
            {
            case InheritanceMode.FromParent:
            {
                bool anyInherited = false;
                InheritSettings(node, ref anyInherited);
                break;
            }

            case InheritanceMode.None:
            case InheritanceMode.Disabled:
                foreach (XmlNode childNode in xmlNode.ChildNodes)
                {
                    try
                    {
                        ISetting setting = (ISetting)SettingProperties[childNode.Name].Property.GetValue(this, null);
                        try
                        {
                            setting.ReadXml(childNode, node);
                        }
                        catch
                        {
                            errors.Add("Error processing Xml node {0}".InvariantFormat(childNode.GetFullPath()));
                        }
                    }
                    catch
                    {
                        errors.Add("Unexpected Xml node {0}".InvariantFormat(childNode.GetFullPath()));
                    }
                }
                break;

            default:
                errors.Add("Unexpected inheritance mode '{0}' in {1}".InvariantFormat(result.ToString(), xmlNode.GetFullPath()));
                break;
            }
        }
Exemplo n.º 3
0
 public InheritSettingsType()
 {
     Mode = InheritanceMode.FromParent;
 }