public void Usage() { ObjectContainer db4oContainer = (ObjectContainer)Container["db4o.container"]; Assert.IsNotNull(db4oContainer); Guid id = Guid.NewGuid(); try { db4oContainer.Set(new Beer(id)); } catch { db4oContainer.Rollback(); } finally { db4oContainer.Commit(); } ObjectSet results = db4oContainer.Get(typeof(Beer)); Assert.AreEqual(1, results.Size()); Beer loaded = (Beer)results.Next(); Assert.AreEqual(id, loaded.Id); db4oContainer.Delete(loaded); db4oContainer.Commit(); results = db4oContainer.Get(typeof(Beer)); Assert.AreEqual(0, results.Size()); }
public static async Task <bool> InsertData(Complain data) { try { /* * // Retrieve the storage account from the connection string. * var storageAccount = CloudStorageAccount.Parse( * ConfigurationManager.AppSettings["StorageConnectionString"]); * * // Create the table client. * CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); * * // Retrieve a reference to the table. * CloudTable table = tableClient.GetTableReference("laporan"); * * // Create the table if it doesn't exist. * table.CreateIfNotExists(); * // Create the TableOperation object that inserts the customer entity. * TableOperation insertOperation = TableOperation.Insert(data); * * // Execute the insert operation. * table.Execute(insertOperation);*/ var db = ObjectContainer.Get <RedisDB>(); data.Id = db.GetId <Complain>(); var res = await db.InsertDoc <Complain>("complain", data); return(res); } catch (Exception ex) { Console.WriteLine(ex.StackTrace + " : " + ex.Message); return(false); } }
public void MigrateDown() { var migrator = ObjectContainer.Get <BasicManifestMigrator>(); var version = migrator.MigrateTo(0); Console.WriteLine("Migrated to {0}", version); }
public TicketServiceController() { db = ObjectContainer.Get <RedisDB>(); if (readyTickets == null) { readyTickets = new ConcurrentQueue <Ticket>(); var datas = from c in db.GetAllData <Ticket>() where c.Status == TicketStatus.Ready select c; foreach (var item in datas) { readyTickets.Enqueue(item); } } if (activeTickets == null) { activeTickets = new ConcurrentDictionary <long, Ticket>(); var datas = from c in db.GetAllData <Ticket>() where c.Status == TicketStatus.Active select c; foreach (var item in datas) { activeTickets.TryAdd(item.UserId, item); } } }
public static void Main(string[] args) { ObjectContainer.Init(new GenerateRegistry()); var executor = ObjectContainer.Get <ICommandExecutor>(); var result = executor.Execute(args.Length == 0 ? "unknown" : args[0]); Console.WriteLine(result); }
public void MigrateTo() { const long to = 42; var migrator = ObjectContainer.Get <BasicManifestMigrator>(); var version = migrator.MigrateTo(to); Console.WriteLine("Migrated to {0}", version); }
internal ISQLQuery CreateSQLQuery(string queryString) { if (Session != null) { return(ObjectContainer.Get <ISQLQuery>(Session.CreateSQLQuery(queryString))); } else { return(ObjectContainer.Get <ISQLQuery>(StatelessSession.CreateSQLQuery(queryString))); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); Lifecycle.Current = new HttpContextLifecycle(); ObjectContainer.Init(new BMRegistry()); ControllerBuilder.Current.SetControllerFactory(new StructureMapControllerFactory()); MappingConfiguration.Init(new BasicManifestMappingProfile()); ObjectContainer.Get <IBasicManifestMigrator>().MigrateUp(); }
public void ConfigureContainer() { ApplicationConfiguration config = new ApplicationConfiguration(); config.ContainerConfiguration.Items.Add(new ObjectContainerAdd() { KeyType = GetTypeFullname("IA"), ObjectType = GetTypeFullname("A") }); config.ContainerConfiguration.Items.Add(new ObjectContainerAdd() { KeyType = GetTypeFullname("IB"), ObjectType = GetTypeFullname("B") }); ObjectContainer container = new ObjectContainer(); ConfigManager.ConfigureContainer(container, config); Assert.AreEqual(2, container.AllObjects.Length); IA a = container.Get<IA>(); Assert.IsNotNull(a); Assert.AreSame(typeof(A), a.GetType()); }
public void ConfigureContainer() { ApplicationConfiguration config = new ApplicationConfiguration(); config.ContainerConfiguration.Items.Add(new ObjectContainerAdd() { KeyType = GetTypeFullname("IA"), ObjectType = GetTypeFullname("A") }); config.ContainerConfiguration.Items.Add(new ObjectContainerAdd() { KeyType = GetTypeFullname("IB"), ObjectType = GetTypeFullname("B") }); ObjectContainer container = new ObjectContainer(); ConfigManager.ConfigureContainer(container, config); Assert.AreEqual(2, container.AllObjects.Length); IA a = container.Get <IA>(); Assert.IsNotNull(a); Assert.AreSame(typeof(A), a.GetType()); }
public UpdateHistoryController() { db = ObjectContainer.Get <RDSDatabase>(); }
public PublicServiceLogic() { db = ObjectContainer.Get <RedisDB>(); }
public void Setup() { Lifecycle.Current = new IntegrationTestLifecycle(); _repo = ObjectContainer.Get <BMRepo>(); _unitOfWork = ObjectContainer.Get <NHibernateUnitOfWork>(); }
protected override IUnitOfWork CreateUnitOfWork() { return(ObjectContainer.Get <IUnitOfWorkFactory>().StartSysCEFUnitOfWork()); }
public override object DoGet(string key) { return(Container.Get(key)); }
public FirmwareInfoController() { db = ObjectContainer.Get <RDSDatabase>(); }
public EMoneyLogic() { db = ObjectContainer.Get <RedisDB>(); }
public DeviceController() { db = ObjectContainer.Get <RDSDatabase>(); }
public UserServiceController() { db = ObjectContainer.Get <RedisDB>(); }
public EmoneyServiceController() { db = ObjectContainer.Get <RedisDB>(); }
public BackupInfoController() { db = ObjectContainer.Get <RDSDatabase>(); }
public UserProfileLogic() { db = ObjectContainer.Get <RedisDB>(); }
static ObjectManager() { objects = new ObjectContainer(new FileInfo("objects.config")); Database = (IDatabase)objects.Get("Database"); }
public virtual ObjectSet FindAll() { return(_objContainer.Get(typeof(Beer))); }
public static T Get <T>(string objectId) { return((T)objects.Get(objectId)); }