public static void Connect(string collectionName) { if (Collection != null) { throw new TraceStateException("Connection already established."); } client = new LiteDB.LiteDatabase(@"MyData.db"); //just to update the description state var databases = client.GetCollectionNames(); if (client == null) { throw new TraceStateException("Local db is unreachable."); } Collection = client.GetCollection <Log>(collectionName); Buffers = new LogBuffer[NumberOfBuffers]; for (int i = 0; i < NumberOfBuffers; i++) { Buffers[i] = new LogBuffer(); } Arbiter = new Arbiter2(Buffers); //I create a new delegate in order to call a method with a Conditional Attribute Arbiter.OnAllBuffersFilled += delegate { Flush(); }; timer = new Timer(2000); timer.AutoReset = true; timer.Elapsed += delegate { Timer_Elapsed(null, null); }; timer.Start(); }
public static void Connect(string collectionName) { if (Collection != null) { throw new TraceStateException("Connection already established."); } client = new MongoClient("mongodb://localhost:27017"); //just to update the description state //var databases = client.ListDatabases(); //if (client.Cluster.Description.State == ClusterState.Disconnected) // throw new TraceStateException("Local db is unreachable."); var database = client.GetDatabase(Dns.GetHostName()); Collection = database.GetCollection <Log>(collectionName); Buffers = new LogBuffer[NumberOfBuffers]; for (int i = 0; i < NumberOfBuffers; i++) { Buffers[i] = new LogBuffer(); } Arbiter = new Arbiter2(Buffers); //I create a new delegate in order to call a method with a Conditional Attribute Arbiter.OnAllBuffersFilled += delegate { Flush(); }; timer = new Timer(2000); timer.AutoReset = true; timer.Elapsed += delegate { Timer_Elapsed(null, null); }; timer.Start(); }
public static void Connect(string collectionName) { if (Collection != null) { throw new TraceStateException("Connection already established."); } ArangoDatabase.ChangeSetting(s => { s.Database = "test"; s.Url = "http://localhost:8529"; // you can set other settings if you need s.Credential = new NetworkCredential("root", ""); s.SystemDatabaseCredential = new NetworkCredential("root", ""); }); client = ArangoDatabase.CreateWithSetting(); //client.CreateDatabase(Dns.GetHostName()); //just to update the description state var databases = client.ListDatabases(); if (client.Connection == null) { throw new TraceStateException("Local db is unreachable."); } //client.CreateCollection("logggs"); Collection = client.Collection(collectionName); Buffers = new LogBuffer[NumberOfBuffers]; for (int i = 0; i < NumberOfBuffers; i++) { Buffers[i] = new LogBuffer(); } Arbiter = new Arbiter2(Buffers); //I create a new delegate in order to call a method with a Conditional Attribute Arbiter.OnAllBuffersFilled += delegate { Flush(); }; timer = new Timer(2000); timer.AutoReset = true; timer.Elapsed += delegate { Timer_Elapsed(null, null); }; timer.Start(); }
public static void Connect(string collectionName) { if (Collection != null) { throw new TraceStateException("Connection already established."); } client = new MyCouchClient("http://*****:*****@localhost:5984", "test"); //just to update the description state var databases = client.Database.GetAsync(); if (client.Connection == null) { throw new TraceStateException("Local db is unreachable."); } Collection = client.Entities; Buffers = new LogBuffer[NumberOfBuffers]; for (int i = 0; i < NumberOfBuffers; i++) { Buffers[i] = new LogBuffer(); } Arbiter = new Arbiter2(Buffers); //I create a new delegate in order to call a method with a Conditional Attribute Arbiter.OnAllBuffersFilled += delegate { Flush(); }; timer = new Timer(2000); timer.AutoReset = true; timer.Elapsed += delegate { Timer_Elapsed(null, null); }; timer.Start(); }