/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param name="indexerType"></param> public StructuredDataStructure(DataStructureCategory indexerType = DataStructureCategory.Generic) { //sample: VariableUsages.First().DataAttribute.ParameterUsages.First().Parameter. Datasets = new List<Dataset>(); Variables = new List<Variable>(); IndexerType = indexerType; }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param name="indexerType"></param> public StructuredDataStructure(DataStructureCategory indexerType = DataStructureCategory.Generic) { //sample: VariableUsages.First().DataAttribute.ParameterUsages.First().Parameter. Datasets = new List <Dataset>(); Variables = new List <Variable>(); IndexerType = indexerType; }
/// <summary> /// Creates a structured data structure <seealso cref="StructuredDataStructure"/> and persists the entity in the database. /// </summary> /// <param name="name">The name of the data structure</param> /// <param name="description">A free text describing the purpose, usage, and/or the domain of the data structure usage.</param> /// <param name="xsdFileName">Not in use.</param> /// <param name="xslFileName">Not in use.</param> /// <param name="indexerType">If the data structure is used as a matrix, The indexer type show what kind of column would be represented by the indexer variable. <see cref="DataStructureCategory"/></param> /// <param name="indexer">The variable indicating the first indexing column of the matrix, if the data structure is representing a matrix.</param> /// <returns>The persisted structured data structure instance.</returns> public StructuredDataStructure CreateStructuredDataStructure(string name, string description, string xsdFileName, string xslFileName, DataStructureCategory indexerType, Variable indexer = null) { Contract.Requires(!string.IsNullOrWhiteSpace(name)); Contract.Requires(indexerType != DataStructureCategory.Generic ? (indexer != null) : true); Contract.Ensures(Contract.Result<StructuredDataStructure>() != null && Contract.Result<StructuredDataStructure>().Id >= 0); StructuredDataStructure e = new StructuredDataStructure() { Name = name, Description = description, XsdFileName = xsdFileName, XslFileName = xslFileName, IndexerType = indexerType, // Indexer = indexer, // how its possible to have the indexer before assigning variable to the structure }; using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository<StructuredDataStructure> repo = uow.GetRepository<StructuredDataStructure>(); repo.Put(e); uow.Commit(); } return (e); }
/// <summary> /// Creates a structured data structure <seealso cref="StructuredDataStructure"/> and persists the entity in the database. /// </summary> /// <param name="name">The name of the data structure</param> /// <param name="description">A free text describing the purpose, usage, and/or the domain of the data structure usage.</param> /// <param name="xsdFileName">Not in use.</param> /// <param name="xslFileName">Not in use.</param> /// <param name="indexerType">If the data structure is used as a matrix, The indexer type show what kind of column would be represented by the indexer variable. <see cref="DataStructureCategory"/></param> /// <param name="indexer">The variable indicating the first indexing column of the matrix, if the data structure is representing a matrix.</param> /// <returns>The persisted structured data structure instance.</returns> public StructuredDataStructure CreateStructuredDataStructure(string name, string description, string xsdFileName, string xslFileName, DataStructureCategory indexerType, Variable indexer = null) { Contract.Requires(!string.IsNullOrWhiteSpace(name)); Contract.Requires(indexerType != DataStructureCategory.Generic ? (indexer != null) : true); Contract.Ensures(Contract.Result <StructuredDataStructure>() != null && Contract.Result <StructuredDataStructure>().Id >= 0); using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository <StructuredDataStructure> repo = uow.GetRepository <StructuredDataStructure>(); IRepository <UnStructuredDataStructure> sRepo = uow.GetRepository <UnStructuredDataStructure>(); if ( (repo.Query(p => p.Name.ToLower() == name.ToLower()).Count() <= 0) && (sRepo.Query(p => p.Name.ToLower() == name.ToLower()).Count() <= 0) ) { StructuredDataStructure e = new StructuredDataStructure() { Name = name, Description = description, XsdFileName = xsdFileName, XslFileName = xslFileName, IndexerType = indexerType, // Indexer = indexer, // how its possible to have the indexer before assigning variable to the structure }; repo.Put(e); uow.Commit(); return(e); } } return(null); }