public virtual object Any(StoreMobileBOSEntity request) { MobileBOSEntityResponse response = new MobileBOSEntityResponse(); IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> _repository = _DataRepositoryFactory.GetDataRepository <IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> >(); if (request.BOSEntity != null) { BOSEntity old = _repository.GetById(request.BOSEntity.Id); BOSEntity updt = old.PopulateWith(request.BOSEntity); updt = _repository.CreateUpdate(updt, CurrentSessionUsername); response.BOSEntity = updt.ConvertTo <MobileBOSEntityDto>(); TrySendStoreNotificationToChannel(typeof(BOSEntity).Name, new List <BOSEntity> { updt }.ToJson()); } return(new HttpResult(response) { ResultScope = () => JsConfig.With(new Config { DateHandler = DateHandler.ISO8601 }) }); //using (JsConfig.With(new Config { DateHandler = DateHandler.ISO8601 })) //{ // return response; //} }
/// <summary> /// Returns a single BOSRecord where the id in the request matches the record ID in the database. /// </summary> /// <param name="request">The request used for requesting the record from the database.</param> /// <returns>If FetchLazy was set to false, the JarsBOSRecord item will be populated, if not then the JarsBOSRecordBase record will be filled with data.</returns> public virtual BOSEntityResponse Any(GetBOSEntity request) { BOSEntityResponse response = new BOSEntityResponse(); IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> _repository = _DataRepositoryFactory.GetDataRepository <IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> >(); response.BOSEntity = _repository.GetById(request.Id, true).ConvertTo <BOSEntityDto>(); return(response); }
public void obtain_generic_repository_using_MEF_and_read_and_create_records() { //now only using mef test the obtainment IGenericEntityRepositoryBase <JarsJob, IDataContextNhJars> jarsRep = _repFactory.GetDataRepository <IGenericEntityRepositoryBase <JarsJob, IDataContextNhJars> >(); IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> extRep = _repFactory.GetDataRepository <IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> >(); //assert creation //Assert.IsNotNull(qlRep); Assert.IsNotNull(jarsRep); Assert.IsNotNull(extRep); //list the jobs from each repository IList <JarsJob> jarsJobs = jarsRep.GetAll(); Assert.IsTrue(jarsJobs != null); IList <BOSEntity> extHeads = extRep.GetAll(); Assert.IsTrue(extHeads != null); //greate a record JarsJob jj = jarsRep.CreateUpdate(new JarsJob(), "MEF_GEN_TEST"); Assert.IsTrue(jj.Id > 0); BOSEntity xj = extRep.CreateUpdate(new BOSEntity(), "MEF_GEN_TEST"); Assert.IsTrue(xj.Id > 0); //get a record from each repository JarsJob job = jarsRep.GetById((long)1); Assert.IsTrue(job.Id == 1); BOSEntity header = extRep.GetById(1); Assert.IsTrue(header.Id == 1); }