Exemple #1
0
 /// <summary>
 /// Retrieves data objects from the data store using the specified parser.
 /// </summary>
 /// <param name="parser">The query template parser.</param>
 /// <param name="context">The response context.</param>
 /// <returns>
 /// A collection of data objects retrieved from the data store.
 /// </returns>
 public virtual List <T> Query(WitsmlQueryParser parser, ResponseContext context)
 {
     throw new NotImplementedException();
 }
Exemple #2
0
 /// <summary>
 /// Gets a list of the element names to ignore during an update.
 /// </summary>
 /// <param name="parser">The WITSML parser.</param>
 /// <returns>A list of element names.</returns>
 protected virtual List <string> GetIgnoredElementNamesForUpdate(WitsmlQueryParser parser)
 {
     return(null);
 }
Exemple #3
0
 /// <summary>
 /// Gets a value indicating whether validation is enabled for this data adapter.
 /// </summary>
 /// <param name="function">The WITSML API method.</param>
 /// <param name="parser">The input template parser.</param>
 /// <param name="dataObject">The data object.</param>
 /// <returns><c>true</c> if validation is enabled for this data adapter; otherwise, <c>false</c>.</returns>
 public virtual bool IsValidationEnabled(Functions function, WitsmlQueryParser parser, T dataObject) => true;
 /// <summary>
 /// Adds a data object to the data store.
 /// </summary>
 /// <param name="parser">The input template parser.</param>
 /// <param name="dataObject">The data object to be added.</param>
 public override void Add(WitsmlQueryParser parser, T dataObject)
 {
     InsertEntity(dataObject);
 }
Exemple #5
0
 /// <summary>
 /// Gets a list of the property names to project during a query.
 /// </summary>
 /// <param name="parser">The WITSML parser.</param>
 /// <returns>A list of property names.</returns>
 protected virtual List <string> GetProjectionPropertyNames(WitsmlQueryParser parser)
 {
     return(null);
 }
Exemple #6
0
 /// <summary>
 /// Retrieves data objects from the data store using the specified parser.
 /// </summary>
 /// <param name="parser">The query template parser.</param>
 /// <param name="context">The response context.</param>
 /// <returns>
 /// A collection of data objects retrieved from the data store.
 /// </returns>
 public override List <T> Query(WitsmlQueryParser parser, ResponseContext context)
 {
     return(QueryEntities(parser));
 }
Exemple #7
0
 /// <summary>
 /// Merges the entity.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="parser">The WITSML query parser.</param>
 /// <param name="mergeDelete">Indicate if it is partial delete.</param>
 protected void MergeEntity(T entity, WitsmlQueryParser parser, bool mergeDelete = false)
 {
     MergeEntity(DbCollectionName, entity, parser, mergeDelete);
 }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MongoDbMerge{T}" /> class.
 /// </summary>
 /// <param name="container">The composition container.</param>
 /// <param name="collection">The collection.</param>
 /// <param name="parser">The parser.</param>
 /// <param name="idPropertyName">Name of the identifier property.</param>
 /// <param name="ignored">The ignored.</param>
 public MongoDbMerge(IContainer container, IMongoCollection <T> collection, WitsmlQueryParser parser, string idPropertyName = "Uid", List <string> ignored = null) :
     base(container, collection, parser, idPropertyName, ignored)
 {
 }
        /// <summary>
        /// Validates the input template for the specified function.
        /// </summary>
        /// <param name="function">The WITSML API method.</param>
        /// <param name="parser">The input template parser.</param>
        /// <param name="dataObject">The data object.</param>
        protected virtual void Validate(Functions function, WitsmlQueryParser parser, TObject dataObject)
        {
            var validator = Container.Resolve <IDataObjectValidator <TObject> >();

            validator.Validate(function, parser, dataObject);
        }
 /// <summary>
 /// Queries the data store using the specified <see cref="WitsmlQueryParser"/>.
 /// </summary>
 /// <param name="parser">The query parser.</param>
 /// <returns>The query results collection.</returns>
 protected virtual List <T> QueryEntities(WitsmlQueryParser parser)
 {
     return(QueryEntities(parser, ObjectName.Name));
 }
 /// <summary>
 /// Gets a value indicating whether validation is enabled for this data adapter.
 /// </summary>
 /// <param name="function">The WITSML API method.</param>
 /// <param name="parser">The input template parser.</param>
 /// <param name="dataObject">The data object.</param>
 /// <returns><c>true</c> if validation is enabled for this data adapter; otherwise, <c>false</c>.</returns>
 public override bool IsValidationEnabled(Functions function, WitsmlQueryParser parser, T dataObject)
 {
     return(MessageHandler.IsValidationEnabled(function, parser, dataObject));
 }
 /// <summary>
 /// Gets a collection of data objects based on the specified query template parser.
 /// </summary>
 /// <param name="parser">The query template parser.</param>
 /// <returns>A collection of data objects retrieved from the data store.</returns>
 protected virtual List <T> GetAll(WitsmlQueryParser parser)
 {
     return(MessageHandler.IsQueryEnabled
         ? TypedMessageHandler.GetAll(parser)
         : new List <T>());
 }
 /// <summary>
 /// Replaces a data object in the data store.
 /// </summary>
 /// <param name="parser">The input template parser.</param>
 /// <param name="dataObject">The data object to be replaced.</param>
 public override void Replace(WitsmlQueryParser parser, T dataObject)
 {
     ReplaceEntity(dataObject);
     //ValidateUpdatedEntity(Functions.PutObject, GetUri(dataObject));
 }
 /// <summary>
 /// Updates a data object in the data store.
 /// </summary>
 /// <param name="parser">The input template parser.</param>
 /// <param name="dataObject">The data object to be updated.</param>
 public override void Update(WitsmlQueryParser parser, T dataObject)
 {
     UpdateEntity(dataObject);
     //ValidateUpdatedEntity(Functions.UpdateInStore, GetUri(dataObject));
 }
Exemple #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MongoDbUpdate{T}" /> class.
 /// </summary>
 /// <param name="container">The composition container.</param>
 /// <param name="collection">The collection.</param>
 /// <param name="parser">The parser.</param>
 /// <param name="idPropertyName">Name of the identifier property.</param>
 /// <param name="ignored">The ignored.</param>
 public MongoDbUpdate(IContainer container, IMongoCollection <T> collection, WitsmlQueryParser parser, string idPropertyName = "Uid", List <string> ignored = null)
     : base(container, collection, parser, idPropertyName, ignored)
 {
     Logger.Verbose("Instance created.");
 }
 /// <summary>
 /// Gets a collection of data objects based on the specified query template parser.
 /// </summary>
 /// <param name="parser">The query template parser.</param>
 /// <returns>A collection of data objects retrieved from the data store.</returns>
 public virtual List <T> GetAll(WitsmlQueryParser parser)
 {
     return(new List <T>());
 }
Exemple #17
0
 /// <summary>
 /// Sets the default values for the specified data object during update.
 /// </summary>
 /// <param name="dataObject">The data object.</param>
 /// <param name="parser">The element.</param>
 protected virtual void UpdateDefaultValues(TObject dataObject, WitsmlQueryParser parser)
 {
 }
Exemple #18
0
 /// <summary>
 /// Replacs a data object in the data store.
 /// </summary>
 /// <param name="parser">The input template parser.</param>
 /// <param name="dataObject">The data object to be replaced.</param>
 public virtual void Replace(WitsmlQueryParser parser, T dataObject)
 {
     throw new NotImplementedException();
 }
Exemple #19
0
 /// <summary>
 /// Updates an object in the data store.
 /// </summary>
 /// <param name="parser">The WITSML query parser.</param>
 /// <param name="uri">The data object URI.</param>
 protected void UpdateEntity(WitsmlQueryParser parser, EtpUri uri)
 {
     UpdateEntity <T>(DbCollectionName, parser, uri);
 }
Exemple #20
0
 /// <summary>
 /// Deletes or partially updates the specified object in the data store.
 /// </summary>
 /// <param name="parser">The input template parser.</param>
 public virtual void Delete(WitsmlQueryParser parser)
 {
     throw new NotImplementedException();
 }
Exemple #21
0
 /// <summary>
 /// Partials the delete entity.
 /// </summary>
 /// <param name="parser">The parser.</param>
 /// <param name="uri">The URI.</param>
 protected void PartialDeleteEntity(WitsmlQueryParser parser, EtpUri uri)
 {
     PartialDeleteEntity <T>(DbCollectionName, parser, uri);
 }
Exemple #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataObjectMapper{T}" /> class.
 /// </summary>
 /// <param name="container">The composition container.</param>
 /// <param name="parser">The query parser.</param>
 /// <param name="fields">The fields of the data object to be selected.</param>
 /// <param name="ignored">The fields of the data object to be ignored.</param>
 public DataObjectMapper(IContainer container, WitsmlQueryParser parser, List <string> fields, List <string> ignored = null) : base(container, new DataObjectMappingContext <T>())
 {
     Context.Ignored = ignored;
     _parser         = parser;
     _fields         = fields;
 }