private void DataSourceDropdown_SelectedIndexChanged(object sender, EventArgs e)
        {
            DomainDataSource dataSource = this.DataSourceDropdown.SelectedItem as DomainDataSource;

            this.TableDropdown.DataSource    = dataSource.GetTables().Where(table => !this.Domain.Tables.Any(t => String.Equals(t.TableName, table, StringComparison.OrdinalIgnoreCase))).ToArray();
            this.TableDropdown.SelectedIndex = -1;
        }
Esempio n. 2
0
        /// <summary>
        ///     Creates a new data source for the domain.
        /// </summary>
        public DomainDataSource CreateDataSource(Type type)
        {
            DomainDataSource datasource = type.Construct(this) as DomainDataSource;

            _dataSources.Add(datasource);
            return(datasource);
        }
Esempio n. 3
0
        private void TypeDropdown_SelectedIndexChanged(object sender, EventArgs e)
        {
            Type dataSourceType = this.TypeDropdown.SelectedValue as Type;

            if (this.DomainDataSource.GetType() != dataSourceType)
            {
                this.DomainDataSource.Domain.Delete(this.DomainDataSource);
                this.DomainDataSource = this.DomainDataSource.Domain.CreateDataSource(dataSourceType);
            }
        }
 /// <summary>
 ///     Deserialises the version history from the specified xml element.
 /// </summary>
 internal static void Deserialise(Domain domain, XmlNode parentNode)
 {
     foreach (XmlNode xmlNode in parentNode.SelectNodes("dataSource"))
     {
         DomainDataSource result = domain.CreateDataSource(Type.GetType(xmlNode.SelectSingleNode("type").InnerText));
         result.Guid             = xmlNode.Attributes["guid"].Value.ConvertTo <Guid>();
         result.Name             = xmlNode.SelectSingleNode("name").InnerText;
         result.Description      = xmlNode.SelectSingleNode("description").InnerText;
         result.ConnectionString = xmlNode.SelectSingleNode("connection").InnerText;
     }
 }
Esempio n. 5
0
        /// <summary>
        ///     Loads the domain from the specified document.
        /// </summary>
        public static Domain Load(String filePath)
        {
            Domain domain = new Domain();

            if (File.Exists(filePath))
            {
                XmlDocument document = new XmlDocument();
                document.Load(filePath);
                domain._version = new Version(document.DocumentElement.Attributes["version"].Value);

                domain.Deserialise(document.DocumentElement);
                DomainTable.Deserialise(domain, document.DocumentElement);
                DomainContainer.Deserialise(domain, document.DocumentElement);
                DomainContainer.DeserialiseExtenders(domain, document.DocumentElement);
                DomainDataSource.Deserialise(domain, document.DocumentElement);
            }
            else
            {
                domain.ChangeVersion(7, 0, 0, 0, 0);
                domain.DomainName = "Consensus";
            }
            return(domain);
        }
Esempio n. 6
0
 /// <summary>
 ///     Initialises a new <see cref="DataSourceEditor" /> instance.
 /// </summary>
 public DataSourceEditor(DomainDataSource domainDataSource)
 {
     this.InitializeComponent();
     this.DomainDataSource = domainDataSource;
 }
        protected override void OnConfirm()
        {
            DomainDataSource domainDataSource = this.DataSourceDropdown.SelectedItem as DomainDataSource;

            domainDataSource.ImportTable(this.TableDropdown.SelectedItem as String);
        }
Esempio n. 8
0
 /// <summary>
 ///     Deletes the specified data source from the domain.
 /// </summary>
 public void Delete(DomainDataSource dataSource)
 {
     _dataSources.Remove(dataSource);
 }