public void LoadConfiguration(DataStoreConfiguration configuration, bool isSource)
 {
     _configuration = configuration;
     InitializeControls(isSource);
     ApplyConfiguration();
     UpdateControlState();
 }
Ejemplo n.º 2
0
        public void ParseRowWithPlainText()
        {
            var configuration = new DataStoreConfiguration
            {
                Columns = new List<DataStoreColumn>
                {
                    new DataStoreColumn { Name = "Name", Length = 12 },
                    new DataStoreColumn { Name = "Age", Length = 2 }
                }
            };

            var store = new FlatFileDataStore(configuration);
            var expected = store.NewRow("John Doe    ", "23");
            var actual = store.ParseRow("John Doe    23");

            TestHelper.AreEqual(expected, actual);
        }
Ejemplo n.º 3
0
        public void ConvertRowWithPlainText()
        {
            var configuration = new DataStoreConfiguration
            {
                Columns = new List<DataStoreColumn>
                {
                    new DataStoreColumn { Name = "Name", Length = 12 },
                    new DataStoreColumn { Name = "Age", Length = 2 },
                    new DataStoreColumn { Name = "Balance", Length = 10, Alignment = ColumnAlignment.Right },
                    new DataStoreColumn { Name = "Owed", Length = 4 }
                }
            };

            var store = new FlatFileDataStore(configuration);
            var row = store.NewRow("John Doe", "23", "123.45", "9915");
            var expected = "John Doe    23    123.459915";
            var actual = store.ConvertRow(row);

            TestHelper.AreEqual(expected, actual);
        }
Ejemplo n.º 4
0
        public void WriteToTable()
        {
            var configuration = new DataStoreConfiguration();
            configuration.ConnectionString = _connectionString;
            configuration.Columns = new List<DataStoreColumn>
            {
                new DataStoreColumn { Name = "First Name", Source = "People" },
                new DataStoreColumn { Name = "Last Name", Source = "People" },
                new DataStoreColumn { Name = "Age", Source = "People" }
            };

            var store = new SqlDataStore(configuration);
            store.Write("John", "Doe", "23");
            store.Write("Jane", "Doe", "21");

            var memoryStore = new MemoryDataStore(configuration);
            memoryStore.Write("John", "Doe", "23");
            memoryStore.Write("Jane", "Doe", "21");

            var actual = store.Read().ToList();
            var expected = memoryStore.Read().ToList();

            TestHelper.AreEqual(expected, actual);
        }
Ejemplo n.º 5
0
        public void ReadFromTable()
        {
            var configuration = new DataStoreConfiguration();
            configuration.ConnectionString = _connectionString;
            configuration.Columns = new List<DataStoreColumn>
            {
                new DataStoreColumn { Name = "First Name", Source = "People" },
                new DataStoreColumn { Name = "Last Name", Source = "People" },
                new DataStoreColumn { Name = "Age", Source = "People" }
            };

            RunSql("INSERT INTO [dbo].[People] ([First Name],[Last Name],[Age]) VALUES ('John', 'Doe', 23)");
            RunSql("INSERT INTO [dbo].[People] ([First Name],[Last Name],[Age]) VALUES ('Jane', 'Doe', 21)");

            var store = new SqlDataStore(configuration);
            var actual = store.Read().ToList();

            var memoryStore = new MemoryDataStore(configuration);
            memoryStore.Write("John", "Doe", "23");
            memoryStore.Write("Jane", "Doe", "21");
            var expected = memoryStore.Read().ToList();

            TestHelper.AreEqual(expected, actual);
        }
 public DataSourceConfigurationControl()
 {
     InitializeComponent();
     _configuration = new DataStoreConfiguration();
 }
Ejemplo n.º 7
0
 public SqlDataStore(DataStoreConfiguration configuration)
     : base(configuration)
 {
 }
Ejemplo n.º 8
0
 public MemoryDataStore(DataStoreConfiguration configuration)
     : base(configuration)
 {
     _rows = new List<DataRow>();
 }
Ejemplo n.º 9
0
        private DataStore GetDataStore(DataStoreConfiguration configuration)
        {
            var dataStoreType = Type.GetType(configuration.StoreFullName + ",Rosetta");
            if (dataStoreType == null)
            {
                throw new ArgumentException("Failed to find type for data store.");
            }

            var dataStore = Activator.CreateInstance(dataStoreType, configuration) as DataStore;
            if (dataStore == null)
            {
                throw new ArgumentException("Failed to create an instance of the data store.");
            }

            dataStore.Initialize();
            return dataStore;
        }
Ejemplo n.º 10
0
 public Settings()
 {
     DestinationStoreConfiguration = new DataStoreConfiguration();
     Mappings = new List<Mapping>();
     SourceStoreConfiguration = new DataStoreConfiguration();
 }
Ejemplo n.º 11
0
 protected FileDataStore(DataStoreConfiguration configuration)
     : base(configuration)
 {
 }
 public CommaSeperatedFileDataStore(DataStoreConfiguration configuration)
     : base(configuration)
 {
 }
Ejemplo n.º 13
0
 public FlatFileDataStore(DataStoreConfiguration configuration)
     : base(configuration)
 {
 }