Example #1
0
File: Client.cs Project: vebin/BD2
 public Client(BD2.Daemon.TransparentAgent agent, BD2.Chunk.ChunkRepository repo, string databaseName)
 {
     if (agent == null)
         throw new ArgumentNullException ("agent");
     if (repo == null)
         throw new ArgumentNullException ("repo");
     if (databaseName == null)
         throw new ArgumentNullException ("databaseName");
     this.agent = agent;
     this.repo = repo;
     this.databaseName = databaseName;
     typeIDs = new Dictionary<Type, long> ();
     typeIDs.Add (typeof(bool), 1);
     typeIDs.Add (typeof(char), 2);
     typeIDs.Add (typeof(byte), 3);
     typeIDs.Add (typeof(byte[]), 4);
     typeIDs.Add (typeof(short), 5);
     typeIDs.Add (typeof(int), 6);
     typeIDs.Add (typeof(long), 7);
     typeIDs.Add (typeof(float), 8);
     typeIDs.Add (typeof(double), 9);
     typeIDs.Add (typeof(Guid), 10);
     typeIDs.Add (typeof(String), 11);
     typeIDs.Add (typeof(DateTime), 12);
     tableDataRequests = new SortedDictionary<Guid, Table> ();
     frontend = new BD2.Frontend.Table.Frontend (new BD2.Frontend.Table.GenericValueDeserializer ());
     frontends = new BD2.Core.FrontendBase[] { frontend };
     db = new BD2.Core.Database (new BD2.Chunk.ChunkRepository[] { repo }, frontends, new byte[]{ }, databaseName);
     ss = db.GetSnapshot ("Primary");
     frontendInstance = (BD2.Frontend.Table.FrontendInstance)frontend.GetInstanse (ss);
     tableColumns = new System.Collections.Concurrent.ConcurrentDictionary<Table, System.Collections.Concurrent.BlockingCollection<Column>> ();
     tables = new SortedDictionary<Guid, Tuple<Table, List<Column>>> ();
 }
Example #2
0
        public void ConvertData_TypeBasedConverters_ConvertsBothWays()
        {
            string a1data = "a1data";
            string a2data = "a2data";
            var a1 = new AD1() { value = a1data };
            var a2 = new AD2() { value = a2data };

            string b1data = "b1data";
            string b2data = "b2data";
            var b1 = new BD1() { value = b1data };
            var b2 = new BD2() { value = b2data };

            JSConversionTool<B, A> tool = new JSConversionTool<B, A>();
            tool.AddConverter(new BD1_AD1MockConverters());
            tool.AddConverter(new BD2_AD2MockConverters());
            B ba1 = tool.ConvertToKnown(a1);
            B ba2 = tool.ConvertToKnown(a2);

            Assert.AreEqual(a1data, ba1.value);
            Assert.AreEqual(a2data, ba2.value);

            A ab1 = tool.ConvertToForeign(b1);
            A ab2 = tool.ConvertToForeign(b2);

            Assert.AreEqual(b1data, ab1.value);
            Assert.AreEqual(b2data, ab2.value);
        }
Example #3
0
File: Row.cs Project: vebin/BD2
 public Row(BD2.Conv.Frontend.Table.ColumnSet columnSet, object[] fields)
     : base(columnSet, fields)
 {
 }