public void FindMetadata_SearchStringIsResourceNameLayerNameIsInvalid_ReturnedEmpty() { var documentSessionProvider = new DocumentSessionProvider ( Store ); var repository = new MetadataRepository ( documentSessionProvider, new FakeMetadataMerger () ); var metadataList = repository.FindMetadata ( ResourceName1, "Not Existed Layer" ); Assert.AreEqual ( 0, metadataList.Count () ); }
public void FindMetadata_SearchStringIsResourceName_ReturnedOneMetadata() { var documentSessionProvider = new DocumentSessionProvider ( Store ); var repository = new MetadataRepository ( documentSessionProvider, new FakeMetadataMerger () ); var metadataList = repository.FindMetadata ( ResourceName1 ); Assert.AreEqual ( 1, metadataList.Count () ); Assert.AreEqual ( ResourceName1, metadataList.First ().ResourceName ); }
public void FindMetadata_SearchStringIsWildchardResourceName_ReturnedTwoMetadata() { var documentSessionProvider = new DocumentSessionProvider ( Store ); var repository = new MetadataRepository ( documentSessionProvider, new FakeMetadataMerger () ); var metadataList = repository.FindMetadata ( "PatientModule.Web.PatientDto.*" ); Assert.AreEqual ( 2, metadataList.Count () ); Assert.AreEqual ( 1, metadataList.Where ( x => x.ResourceName == ResourceName1 ).Count () ); Assert.AreEqual ( 1, metadataList.Where ( x => x.ResourceName == ResourceName2 ).Count () ); }
public void Init() { var mockIoc = new MockIocContainer(true); var serviceProvider = mockIoc.CreateServiceProvider(); m_mockDataManager = serviceProvider.GetRequiredService <MockDataManager>(); m_projectRepository = serviceProvider.GetRequiredService <ProjectRepository>(); m_metadataRepository = serviceProvider.GetRequiredService <MetadataRepository>(); m_importedRecordMetadataRepository = serviceProvider.GetRequiredService <ImportedRecordMetadataRepository>(); m_importedProjectMetadataRepository = serviceProvider.GetRequiredService <ImportedProjectMetadataRepository>(); m_importedProjectManager = serviceProvider.GetRequiredService <ImportedProjectManager>(); m_importedRecord = new ImportedRecord { IsNew = true, IsFailed = false, IsDeleted = false, ImportedProject = new ImportedProject { Id = "1", ProjectMetadata = new ProjectMetadata { Title = "Title", PublisherText = "PublisherText", PublishDate = "PublishDate", PublishPlace = "PublishPlace", }, Authors = new HashSet <Author> { new Author("Jan", "Hus") }, Keywords = new List <string> { "Keyword" }, LiteraryGenres = new List <string> { "LiteraryGenre" } }, ExternalId = "Ext1" }; }
// This function will get triggered/executed when a new message is written // on an Azure Queue called queue. public static void ProcessQueueMessage([ServiceBusTrigger("thumbnails")] BrokeredMessage message, TextWriter log) { var imgOriginalId = (Guid)message.Properties["imageId"]; //var imgOriginalId = Newtonsoft.Json.JsonConvert.DeserializeObject<Guid>(b); IRepository <Epam.AzureWorkShop.Entities.Image> imgRepo = new ImageRepository(); var currentImg = imgRepo.GetById(imgOriginalId); using (var image = Image.Load(currentImg.Data)) { image.Mutate(i => i.Resize(150, 150)); using (var outputMemory = new MemoryStream()) { image.Save(outputMemory, new PngEncoder()); var id = imgRepo.Add(new Epam.AzureWorkShop.Entities.Image { Data = outputMemory.ToArray(), }).Id; var metRep = new MetadataRepository(); var metData = metRep.GetByImageId(imgOriginalId); metData.ThumbnailId = id; metRep.Update(metData); using (var httpClient = new HttpClient()) { httpClient.BaseAddress = new Uri(ConfigurationManager.AppSettings["LogicAppUri"]); var content = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>(nameof(ImageMetadata.FileName), metData.FileName), new KeyValuePair <string, string>(nameof(ImageMetadata.ImageId), metData.ImageId.ToString()), new KeyValuePair <string, string>(nameof(ImageMetadata.ThumbnailId), metData.ThumbnailId.ToString()), }); httpClient.PostAsync(ConfigurationManager.AppSettings["LogicAppUri"], content).Wait(); } } } }
/// <summary> /// Indicates whether the data manipulator is manipulating a given field. /// </summary> /// <param name="fieldName">Name of the field on which to exam for use in the data manipulator.</param> /// <returns>True if the data manipulator use the field otherwise false.</returns> protected override bool ManipulatingField(string fieldName) { lock (SyncRoot) { if (_currentDataSource == null) { _currentDataSource = MetadataRepository.DataSourceGet(); } try { ITable dataManipulatorTable; try { dataManipulatorTable = _currentDataSource.Tables.Single(table => String.Compare(TableName, table.NameSource, StringComparison.OrdinalIgnoreCase) == 0); } catch (InvalidOperationException) { dataManipulatorTable = _currentDataSource.Tables.SingleOrDefault(table => String.Compare(TableName, table.NameTarget, StringComparison.OrdinalIgnoreCase) == 0); } if (dataManipulatorTable == null) { throw new DeliveryEngineSystemException(Resource.GetExceptionMessage(ExceptionMessage.TableNotFound, TableName)); } try { return(_worker.IsManipulatingField(fieldName, dataManipulatorTable)); } finally { dataManipulatorTable = null; Debug.Assert(dataManipulatorTable == null); } } finally { GC.Collect(); } } }
protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); PicklistAttributeMetadata attribute = new PicklistAttributeMetadata(); if (DefaultValue.HasValue) { attribute.DefaultFormValue = DefaultValue; } switch (this.ParameterSetName) { case AddOptionSetNewParameterSet: attribute.OptionSet = new OptionSetMetadata(); foreach (PSOptionSetValue item in Values) { OptionMetadata option = new OptionMetadata(new Label(item.DisplayName, CrmContext.Language), item.Value); attribute.OptionSet.Options.Add(option); } break; case AddOptionSetExistingParameterSet: MetadataRepository repository = new MetadataRepository(); OptionSetMetadata optionset = repository.GetOptionSet(OptionSet) as OptionSetMetadata; if (optionset.IsGlobal.GetValueOrDefault()) { attribute.OptionSet.Options.Clear(); } attribute.OptionSet = optionset; break; default: break; } WriteAttribute(attribute); }
public void MetadataRepositoryGetByMovieId_RetrievesHighestIdForLanguage() { // Arrange var itemUnderTest = new MetadataRepository(); itemUnderTest.Movies.AddRange(new[] { new MetadataItem(id: 1, movieId: 2, title: "Test", language: "BB", duration: TimeSpan.Parse("10:10:10"), releaseYear: 2019), new MetadataItem(id: 2, movieId: 2, title: "Test", language: "BB", duration: TimeSpan.Parse("10:10:10"), releaseYear: 2019), new MetadataItem(id: 3, movieId: 2, title: "Test", language: "AA", duration: TimeSpan.Parse("10:10:10"), releaseYear: 2019), }); // Act var data = itemUnderTest.GetByMovieId(2).ToArray(); // Assert Assert.That(data.Length == 2); // One record (id: 1) should be filtered Assert.That(data[0].Language == "AA"); // We should be sorted by language Assert.That(data[1].Language == "BB"); Assert.That(data[1].Id == 2); // We want the higher Id with language BB }
public void Get_Search_Index_Object_Graph() { var connection = new ConnectionSettingProvider(); var elastic = new ElasticClient( connection.Get() .DefaultIndex("gbs.info*")); var metadataRepo = new MetadataRepository(elastic); var infoRepo = new InformationRepository(elastic, new AttachmentProcessor(), new ItemMetadataProvider(metadataRepo)); var result = infoRepo.GetItemWithAttachments( new Guid("62169a15-d2a1-4741-a8c4-c9d4f7f08f7c"), new [] { typeof(SearchIndex), typeof(Site) }, true); var temp = "testing"; result = infoRepo.GetItemWithAttachments( new Guid("62169a15-d2a1-4741-a8c4-c9d4f7f08f7c"), new[] { typeof(SearchIndex), typeof(Site) }, true); }
private static string GetDefaultLayout(string entityName, ref string detailLayout) { var entity = MetadataRepository.Entities.Single(e => e.PhysicalName == entityName); var savedQueries = MetadataRepository.GetSavedQuery(entity.EntityId); var defaultQuery = savedQueries.FirstOrDefault(q => q.QueryType == 0 && q.IsDefault); if (defaultQuery == null) { defaultQuery = savedQueries.FirstOrDefault(); } if (defaultQuery == null) { throw new Exception("This is no default list view layout for " + entityName); } var detailQuery = savedQueries.FirstOrDefault(q => q.QueryParentId == defaultQuery.SavedQueryId); if (detailQuery != null) { detailLayout = detailQuery.LayoutXml; } return(defaultQuery.LayoutXml); }
//public CodeCampService(StandardKernel kernel) //{ // _personRepository = kernel.Get<PersonRepository>(); // _sessionRepository = kernel.Get<SessionRepository>(); // _metadataRepository = kernel.Get<MetadataRepository>(); // _taskRepository = kernel.Get<TaskRepository>(); // _tagRepository = kernel.Get<TagRepository>(); //} public CodeCampService(PersonRepository personRepo, SessionRepository sessionRepo, MetadataRepository metaRepo, TaskRepository taskRepo, TagRepository tagRepo) { _personRepository = personRepo; _sessionRepository = sessionRepo; _metadataRepository = metaRepo; _taskRepository = taskRepo; _tagRepository = tagRepo; }
public QueryService(ITeclynContext context, TeclynApi teclyn, IIocContainer iocContainer, MetadataRepository metadataRepository) { this.context = context; this.teclyn = teclyn; this.iocContainer = iocContainer; this.metadataRepository = metadataRepository; }
/// <summary> /// Persists the metadata item to the data store, or deletes it when the delete flag is set. /// For certain items (title, filename, etc.), the associated gallery object's property is also /// updated. For items that are being deleted, it is also removed from the gallery object's metadata /// collection. /// </summary> /// <param name="md">An instance of <see cref="IGalleryObjectMetadataItem" /> to persist to the data store.</param> /// <param name="userName">The user name of the currently logged on user. This will be used for the audit fields.</param> /// <exception cref="InvalidMediaObjectException">Thrown when the requested meta item does not exist /// in the data store.</exception> public static void SaveGalleryObjectMetadataItem(IGalleryObjectMetadataItem md, string userName) { using (var repo = new MetadataRepository()) { repo.Save(md); } SyncWithGalleryObjectProperties(md, userName); }
public void GetMetadata_ResourceNameExistLayerNameExist_ReturnedTheMetadata() { var documentSessionProvider = new DocumentSessionProvider ( Store ); var repository = new MetadataRepository ( documentSessionProvider, new FakeMetadataMerger () ); IMetadata metadata = repository.GetMetadata ( ResourceName1, LayerName1 ); Assert.IsNotNull ( metadata ); Assert.AreEqual ( ResourceName1, metadata.ResourceName ); }
public UpdateMetadataSubtask(MetadataRepository metadataRepository) { m_metadataRepository = metadataRepository; }
/// <summary> /// Initializes a new instance of the <see cref="OptionSetFactory"/> class. /// </summary> /// <param name="metadataRepository">The metadata repository.</param> public OptionSetFactory(MetadataRepository metadataRepository) { _metadataRepository = metadataRepository; }
public MetadataController(MetadataRepository metadataRepository) { this.MetadataRepository = metadataRepository; }
public DocumentMetadataController(ILogger <DocumentMetadataController> logger, MetadataRepository metadata, DocumentRepository documentRepository, SecurityRepository securityRepository) { _metadataRepository = metadata; _logger = logger; _documentRepository = documentRepository; _securityRepository = securityRepository; }
public void FillData(string tableName, DbDataReader data) { m_pendingRepository = m_pendingRepository ?? m_repository.CloneEditable(); m_pendingRepository.FillData(tableName, data); }
public void FillData(string tableName, DataTable table) { m_pendingRepository = m_pendingRepository ?? m_repository.CloneEditable(); m_pendingRepository.FillData(tableName, table); }
/// <summary> /// Deletes the root album for the current gallery and all child items, but leaves the directories and original files on disk. /// This function also deletes the metadata for the root album, which will leave it in an invalid state. For this reason, /// call this function *only* when also deleting the gallery the album is in. /// </summary> private void DeleteRootAlbum() { // Step 1: Delete the root album contents var rootAlbum = Factory.LoadRootAlbumInstance(GalleryId); rootAlbum.DeleteFromGallery(); // Step 2: Delete all metadata associated with the root album of this gallery using (var repo = new MetadataRepository()) { foreach (var dto in repo.Where(m => m.FKAlbumId == rootAlbum.Id)) { repo.Delete(dto); } repo.Save(); } }
public void GetMetadata_ResourceNameExistLayerNameNotExist_ReturnedNull() { var documentSessionProvider = new DocumentSessionProvider ( Store ); var repository = new MetadataRepository ( documentSessionProvider, new FakeMetadataMerger () ); IMetadata metadata = repository.GetMetadata ( ResourceName1, "Not Existed Layer" ); Assert.IsNull ( metadata ); }
public MetricsController(MetadataRepository repository) { _repository = repository; }
public void GetKeywords_ContextItemWithWrongTemplate_ShouldReturnNull([Content] Item contextItem) { MetadataRepository.GetKeywords(contextItem).Should().BeNull(); }
/// <summary> /// Configures NHibernate and creates a member-level session factory. /// </summary> public void Initialize() { // Initialize Configuration cfg = new Configuration(); cfg.Configure(); // Add class mappings to configuration object cfg.AddAssembly(this.GetType().Assembly); // Create session factory from configuration object _sessionFactory = cfg.BuildSessionFactory(); _userRepository = new UserRepository(_sessionFactory); _metadataRepository = new MetadataRepository(_sessionFactory); _configurationMongoRepository = new ConfigurationRepository(new WebConfigConnectionStringRepository()); }
public static void Main(string[] args) { var builder = new ContainerBuilder(); builder.RegisterType <UIElementAdapterFactoryCatalog>().As <IUIElementAdapterFactoryCatalog>().SingleInstance(); var container = builder.Build(); IoC.GetInstance = (t, p) => container.Resolve(t); Application.ThreadException += Application_ThreadException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; SkinManager.EnableFormSkins(); BonusSkins.Register(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CriteriaOperator.RegisterCustomFunction(new IsDuringDaysFunction()); CriteriaOperator.RegisterCustomFunction(new IsEarlierNextWeekFunction()); CriteriaOperator.RegisterCustomFunction(new IsLastMonthFunction()); CriteriaOperator.RegisterCustomFunction(new IsPriorDaysFunction()); DevExpress.Utils.AppearanceObject.DefaultFont = System.Drawing.SystemFonts.DefaultFont; // The LoggingService is a small wrapper around log4net. // Our application contains a .config file telling log4net to write // to System.Diagnostics.Trace. ICSharpCode.Core.Services.ServiceManager.Instance = new Katrin.AppFramework.WinForms.Services.ServiceManager(); LoggingService.Info("Application start"); // Get a reference to the entry assembly (Startup.exe) Assembly exe = typeof(Program).Assembly; // Set the root path of our application. ICSharpCode.Core looks for some other // paths relative to the application root: // "data/resources" for language resources, "data/options" for default options FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location); LoggingService.Info("Starting core services..."); // CoreStartup is a helper class making starting the Core easier. // The parameter is used as the application name, e.g. for the default title of // MessageService.ShowMessage() calls. CoreStartup coreStartup = new CoreStartup("Katrin"); // It is also used as default storage location for the application settings: // "%Application Data%\%Application Name%", but you can override that by setting c.ConfigDirectory // Specify the name of the application settings file (.xml is automatically appended) coreStartup.PropertiesName = "AppProperties"; // Initializes the Core services (ResourceService, PropertyService, etc.) coreStartup.StartCoreServices(); // Registeres the default (English) strings and images. They are compiled as // "EmbeddedResource" into Startup.exe. // Localized strings are automatically picked up when they are put into the // "data/resources" directory. ResourceService.RegisterNeutralStrings(new ResourceManager("Katrin.Shell.Resources.StringResources", exe)); ResourceService.RegisterNeutralImages(new ResourceManager("Katrin.Shell.Resources.ImageResources", exe)); System.Threading.Thread.CurrentThread.CurrentCulture = CultureManager.CurrentCulture; ResourceService.Language = CultureManager.CurrentCulture.Name; LoggingService.Info("Looking for AddIns..."); // Searches for ".addin" files in the application directory. coreStartup.AddAddInsFromDirectory(Path.Combine(FileUtility.ApplicationRootPath, "AddIns")); // Searches for a "AddIns.xml" in the user profile that specifies the names of the // add-ins that were deactivated by the user, and adds "external" AddIns. coreStartup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml")); // Searches for add-ins installed by the user into his profile directory. This also // performs the job of installing, uninstalling or upgrading add-ins if the user // requested it the last time this application was running. coreStartup.ConfigureUserAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"), Path.Combine(PropertyService.ConfigDirectory, "AddIns")); LoggingService.Info("Loading AddInTree..."); // Now finally initialize the application. This parses the ".addin" files and // creates the AddIn tree. It also automatically runs the commands in // "/Workspace/Autostart" coreStartup.RunInitialization(); LoggingService.Info("Initializing Workbench..."); // Workbench is our class from the base project, this method creates an instance // of the main form. LoginForm loginForm = new LoginForm(); loginForm.ShowDialog(); try { LoggingService.Info("Running application..."); // Workbench.Instance is the instance of the main form, run the message loop. if (SecurityContext.IsLogon) { var catalog = IoC.Get <IUIElementAdapterFactoryCatalog>(); catalog.RegisterFactory(new XtraNavBarUIAdapterFactory()); catalog.RegisterFactory(new XtraBarUIAdapterFactory()); catalog.RegisterFactory(new RibbonUIAdapterFactory()); catalog.RegisterFactory(new NavigatorCustomButtonUIAdapterFactory()); catalog.RegisterFactory(new EditorButtonCollectionUIAdapterFactory()); ODataObjectSpace.Initialize(); MetadataRepository.Initialize(); MainForm mainForm = new MainForm(); mainForm.FormClosed += mainForm_FormClosed; mainForm.Show(); Application.Run(); } } catch (Exception ex) { MessageService.ShowException(ex, ex.Message); } finally { LoadingFormManager.EndLoading(); try { // Save changed properties PropertyService.Save(); } catch (Exception ex) { MessageService.ShowException(ex, ex.Message); } } LoggingService.Info("Application shutdown"); }
public SetLiteraryGenreWork(MetadataRepository metadataRepository, long projectId, IList <int> genreIdList) : base(metadataRepository.UnitOfWork) { m_metadataRepository = metadataRepository; m_projectId = projectId; m_genreIdList = genreIdList; }
public CreatePublisherWork(MetadataRepository metadataRepository, PublisherContract data) : base(metadataRepository.UnitOfWork) { m_metadataRepository = metadataRepository; m_data = data; }
public static string GetComponentName(int componentType, Guid objectId) { MetadataRepository mdr = new MetadataRepository(); string componentLogicalName = null; string primaryNameAttribute = null; switch (componentType) { case 1: //Entity return(mdr.GetEntity(objectId).LogicalName); case 2: //Attribute return(mdr.GetAttribute(objectId).LogicalName); case 3: //Relationship return(mdr.GetRelationship(objectId).SchemaName); case 9: //Option Set return(mdr.GetOptionSet(objectId).Name); case 10: //Entity Relationship return(mdr.GetRelationship(objectId).SchemaName); case 13: //Managed Property return(mdr.GetManagedProperty(objectId).LogicalName); case 11: //Relationship Role componentLogicalName = "relationshiprole"; primaryNameAttribute = "name"; break; case 20: //Security Role componentLogicalName = "role"; primaryNameAttribute = "name"; break; case 21: //Privilege componentLogicalName = "privilege"; primaryNameAttribute = "name"; break; case 24: //User Dashboard componentLogicalName = "userform"; primaryNameAttribute = "name"; break; case 25: //Organization componentLogicalName = "organization"; primaryNameAttribute = "name"; break; case 26: //View componentLogicalName = "savedquery"; primaryNameAttribute = "name"; break; case 29: //Process componentLogicalName = "workflow"; primaryNameAttribute = "name"; break; case 31: //Report componentLogicalName = "report"; primaryNameAttribute = "name"; break; case 36: //Email Template componentLogicalName = "template"; primaryNameAttribute = "title"; break; case 37: //Contract Template componentLogicalName = "contracttemplate"; primaryNameAttribute = "name"; break; case 38: //Article Template componentLogicalName = "kbarticletemplate"; primaryNameAttribute = "title"; break; case 39: //Mail Merge Template componentLogicalName = "mailmergetemplate"; primaryNameAttribute = "name"; break; case 44: //Duplicate Detection Rule componentLogicalName = "duplicaterule"; primaryNameAttribute = "name"; break; case 59: //System Chart componentLogicalName = "savedqueryvisualization"; primaryNameAttribute = "name"; break; case 60: //System Form componentLogicalName = "systemform"; primaryNameAttribute = "name"; break; case 61: //Web Resource componentLogicalName = "webresource"; primaryNameAttribute = "name"; break; case 63: //Connection Role componentLogicalName = "connectionrole"; primaryNameAttribute = "name"; break; case 65: //Hierarchy Rule componentLogicalName = "hierarchyrule"; primaryNameAttribute = "name"; break; case 70: //Field Security Profile componentLogicalName = "fieldsecurityprofile"; primaryNameAttribute = "name"; break; case 90: //Plug-in Type componentLogicalName = "plugintype"; primaryNameAttribute = "name"; break; case 91: //Plug-in Assembly componentLogicalName = "pluginassembly"; primaryNameAttribute = "name"; break; case 92: //Sdk Message Processing Step componentLogicalName = "sdkmessageprocessingstep"; primaryNameAttribute = "name"; break; case 93: //Sdk Message Processing Step Image componentLogicalName = "sdkmessageprocessingstepimage"; primaryNameAttribute = "name"; break; case 95: //Service Endpoint componentLogicalName = "serviceendpoint"; primaryNameAttribute = "name"; break; case 150: //Routing Rule Set componentLogicalName = "routingrule"; primaryNameAttribute = "name"; break; case 151: //Rule Item componentLogicalName = "routingruleitem"; primaryNameAttribute = "name"; break; case 152: //SLA componentLogicalName = "sla"; primaryNameAttribute = "name"; break; case 154: //Record Creation and Update Rule componentLogicalName = "convertrule"; primaryNameAttribute = "name"; break; case 155: //Record Creation and Update Rule Item componentLogicalName = "convertruleitem"; primaryNameAttribute = "name"; break; default: componentLogicalName = null; primaryNameAttribute = null; break; } if (!string.IsNullOrWhiteSpace(componentLogicalName) && !string.IsNullOrWhiteSpace(primaryNameAttribute)) { ContentRepository ctr = new ContentRepository(); Entity componentEntity = ctr.Get(componentLogicalName, objectId); return(componentEntity.GetAttributeValue <string>(primaryNameAttribute)); } return(null); }
public OnBeforeUploadContext(ApplicationSchemaDefinition application, MetadataRepository metadataRepository, User user) : base(application, metadataRepository, user) { }
public GetLatestProjectMetadataWork(MetadataRepository metadataRepository, long projectId, GetProjectMetadataParameter parameters) : base(metadataRepository.UnitOfWork) { m_metadataRepository = metadataRepository; m_projectId = projectId; m_parameters = parameters; }
public OnNewContext(ApplicationSchemaDefinition application, MetadataRepository metadataRepository, User user, CompositeDataMap composite) : base(application, metadataRepository, user) { _composite = composite; }
public CachedMetadataService(MetadataRepository metadataRepository, IMemoryCache memoryCache) : base(metadataRepository) { _memoryCache = memoryCache; _cacheOptions = new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(Constants.MinutesToCache)); }
/// <summary> /// Execute the delivery engine to create and write the delivery format. /// </summary> /// <param name="command">Command for executing the delivery engine.</param> public virtual void Execute(IDeliveryEngineExecuteCommand command) { if (command == null) { throw new ArgumentNullException("command"); } try { // Get the data source. RaiseEvent(BeforeGetDataSource, new GetDataSourceEventArgs()); var dataSource = MetadataRepository.DataSourceGet(); if (!string.IsNullOrEmpty(command.OverrideArchiveInformationPackageId)) { dataSource.ArchiveInformationPackageId = command.OverrideArchiveInformationPackageId; } ArchiveVersionRepository.DataSource = dataSource; // Archive the metadata for the data source. if (command.ValidationOnly == false) { RaiseEvent(BeforeArchiveMetadata, new ArchiveMetadataEventArgs(dataSource)); ArchiveVersionRepository.ArchiveMetaData(); } // Handle and archive any target tables included in the data source. DataRepository.OnHandleData += HandleDataForTargetTable; DataRepository.OnClone += DataRepositoryCloned; var tableWorkers = new Collection <BackgroundWorker>(); try { var namedObjectComparer = new NameTargetComparer(); var targetTables = dataSource.Tables .Where(m => string.IsNullOrEmpty(m.NameTarget) == false && (string.IsNullOrEmpty(command.Table) || Regex.IsMatch(m.NameTarget, command.Table, RegexOptions.Compiled))) .Distinct(namedObjectComparer) .OfType <ITable>() .ToList(); foreach (var targetTable in targetTables) { while (tableWorkers.Count(m => m.IsBusy) >= (command.TablesHandledSimultaneity <= 0 ? 1 : command.TablesHandledSimultaneity) && _errors.Any() == false) { Thread.Sleep(250); } if (_errors.Any()) { throw _errors.ElementAt(0); } var tableWorker = new BackgroundWorker { WorkerReportsProgress = false, WorkerSupportsCancellation = true }; tableWorker.DoWork += HandleTargetTableDoWork; tableWorker.RunWorkerCompleted += WorkerCompleted; tableWorker.Disposed += (sender, eventArgs) => tableWorkers.Remove((BackgroundWorker)sender); tableWorkers.Add(tableWorker); tableWorker.RunWorkerAsync(new Tuple <ITable, IDataSource, IDeliveryEngineExecuteCommand>(targetTable, dataSource, command)); } while (tableWorkers.Any(m => m.IsBusy)) { if (_errors.Any()) { throw _errors.ElementAt(0); } Thread.Sleep(250); } } finally { foreach (var tableWorker in tableWorkers.Where(m => m.IsBusy)) { tableWorker.CancelAsync(); } while (tableWorkers.Any(m => m.IsBusy)) { Thread.Sleep(250); } while (tableWorkers.Count > 0) { var tableWorker = tableWorkers.ElementAt(0); tableWorker.Dispose(); tableWorkers.Remove(tableWorker); } } } catch (DeliveryEngineAlreadyHandledException) { } catch (Exception ex) { lock (_syncRoot) { ExceptionHandler.HandleException(ex); } } finally { lock (_syncRoot) { while (_tableInformations.Count > 0) { _tableInformations.Clear(); } } while (_errors.Count > 0) { _errors.Clear(); } } }
public FeedApi(IApiConfiguration config) { this.config = config; this.persister = new MetadataPersister(this.config.MarketsFilePath, this.config.SymbolsFilePath); this.Repository = this.InitRepositorySafe(); }
public MetadataController(MetadataRepository metadata, IAuthService auth) { Metadata = metadata; Auth = auth; }
public SetResponsiblePersonsWork(MetadataRepository metadataRepository, long projectId, IList <int> responsiblePersonIdList) : base(metadataRepository.UnitOfWork) { m_metadataRepository = metadataRepository; m_projectId = projectId; m_responsiblePersonIdList = responsiblePersonIdList; }
public MetadataService(MetadataRepository metadataRepository) => _metadataRepository = metadataRepository;
/// <summary> /// Loads the metadata item for the specified <paramref name="metadataId" />. If no matching /// object is found in the data store, null is returned. /// </summary> /// <param name="metadataId">The ID that uniquely identifies the metadata item.</param> /// <returns>An instance of <see cref="IGalleryObjectMetadataItem" />, or null if not matching /// object is found.</returns> public static IGalleryObjectMetadataItem LoadGalleryObjectMetadataItem(int metadataId) { //var mDto = GetDataProvider().Metadata_GetMetadataItem(metadataId); var mDto = new MetadataRepository().Find(metadataId); if (mDto == null) return null; var go = mDto.FKAlbumId.HasValue ? LoadAlbumInstance(mDto.FKAlbumId.Value, false) : LoadMediaObjectInstance(mDto.FKMediaObjectId.GetValueOrDefault(0)); var metaDefs = LoadGallerySetting(go.GalleryId).MetadataDisplaySettings; return CreateMetadataItem(mDto.MetadataId, go, mDto.RawValue, mDto.Value, false, metaDefs.Find(mDto.MetaName)); }