/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { Metrics = new Metrics(this); Events = new Events(this); Query = new QueryOperations(this); BaseUri = new System.Uri("https://api.applicationinsights.io/v1"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <EventsResultData>("type")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <EventsResultData>("type")); CustomInitialize(); }
/// <summary> /// Executes a query that allows traversing relationships and filtering by /// property values. /// Status codes: /// 200 (OK): Success. /// 400 (Bad Request): The request is invalid. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='querySpecification'> /// The query specification to execute. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <QueryResult> QueryTwinsAsync(this IQueryOperations operations, QuerySpecification querySpecification, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.QueryTwinsWithHttpMessagesAsync(querySpecification, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Execute an Analytics query /// </summary> /// <remarks> /// Executes an Analytics query for data. /// [Here](https://dev.applicationinsights.io/documentation/Using-the-API/Query) /// is an example for using POST with an Analytics query. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='appId'> /// ID of the application. This is Application ID from the API Access settings /// blade in the Azure portal. /// </param> /// <param name='query'> /// The query to execute. /// </param> /// <param name='timespan'> /// Optional. The timespan over which to query data. This is an ISO8601 time /// period value. This timespan is applied in addition to any that are /// specified in the query expression. /// </param> /// <param name='applications'> /// A list of Application IDs for cross-application queries. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <QueryResults> ExecuteAsync(this IQueryOperations operations, string appId, string query, string timespan = default(string), IList <string> applications = default(IList <string>), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ExecuteWithHttpMessagesAsync(appId, query, timespan, applications, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public IEnumerable <ReportOverview> Get(string workArea, string productionLineFilter, string workCellFilter, string ruleTypeFilter, string materialFilter, int pageNumber, int pageSize) { var list = new List <ReportOverview>(); IQueryOperations storageManager = StorageManagerFactory.CreateDatabaseManager(this.ConnectionString); var set = storageManager.ExecuteCommand("sp_VCC_local_reportOverview", new[] { this.CreateDataParameter("@workArea", workArea), this.CreateDataParameter("@productionLineFilter", productionLineFilter), this.CreateDataParameter("@workCellFilter", workCellFilter), this.CreateDataParameter("@ruleTypeFilter", ruleTypeFilter), this.CreateDataParameter("@materialFilter", materialFilter), this.CreateDataParameter("@pageNumber", pageNumber), this.CreateDataParameter("@pageSize", pageSize), }); if (set.IsEmpty()) { return(list); } var rows = set.Tables[0].Rows.Cast <DataRow>(); return(rows.MapTo <IEnumerable <ReportOverview> >()); }
static GeoPointForSeries() { Operations = new QueryOperations<GeoPointForSeries>( //Smallerthan (q, gt) => q.Where(row => row.PointID < gt.PointID), //Equals (q, gt) => q.Where(row => row.PointID == gt.PointID), //Orderby (q) => q.OrderBy(gt => gt.PointID), //FreeKey (q, gt) => { gt.PointID = QueryOperations<GeoPointForSeries>.FindFreeIntKeyUp(q, row => row.PointID);//As there is no corredponding table in DiversityCollection we choose to count up to model a sequence }); }
static TaxonName() { Operations = new QueryOperations<TaxonName>( //Smallerthan (q, es) => q.Where(row => row.URI.CompareTo(es.URI) <0), //Equals (q, es) => q.Where(row => row.URI == es.URI), //Orderby (q) => q.OrderBy(es => es.URI), //FreeKey (q, es) => { //Not Applicable }); }
static Analysis() { Operations = new QueryOperations<Analysis>( //Smallerthan (q, an) => q.Where(row => row.AnalysisID < an.AnalysisID), //Equals (q, an) => q.Where(row => row.AnalysisID == an.AnalysisID), //Orderby (q) => q.OrderBy(an => an.AnalysisID), //FreeKey (q, an) => { an.AnalysisID = QueryOperations<Analysis>.FindFreeIntKey(q, row => row.AnalysisID); }); }
// GET api/<controller> public IEnumerable <ReportOverviewViewModel> Get(string area) { var list = new List <ReportOverviewViewModel>(); IQueryOperations storageManager = StorageManagerFactory.CreateDatabaseManager(_connectionString); var set = storageManager.ExecuteCommand("sp_VCC_local_reportOverview", new[] { new SqlParameter("@workArea", area) }); if (set.IsEmpty()) { return(list); } var rows = set.Tables[0].Rows.Cast <DataRow>(); return(rows.MapTo <IEnumerable <ReportOverviewViewModel> >()); }
static AnalysisResult() { Operations = new QueryOperations<AnalysisResult>( //Smallerthan (q, ar) => q.Where(row => row.AnalysisID < ar.AnalysisID || row.Result.CompareTo(ar.Result) < 0), //Equals (q, ar) => q.Where(row => row.AnalysisID == ar.AnalysisID && row.Result == ar.Result), //Orderby (q) => from ar in q orderby ar.AnalysisID, ar.Result select ar, //FreeKey (q, ar) => { //Nothing To Do. }); }
public OperationsController(ActorSystem system, IQueryOperations operationQuery) : base(system) { _operationQuery = operationQuery; }
static IdentificationUnitAnalysis() { Operations = new QueryOperations<IdentificationUnitAnalysis>( //Smallerthan (q, iuan) => q.Where(row => row.IdentificationUnitAnalysisID < iuan.IdentificationUnitAnalysisID), //Equals (q, iuan) => q.Where(row => row.IdentificationUnitAnalysisID == iuan.IdentificationUnitAnalysisID), //Orderby (q) => q.OrderBy(iuan => iuan.IdentificationUnitAnalysisID), //FreeKey (q, iuan) => { iuan.IdentificationUnitAnalysisID = QueryOperations<IdentificationUnitAnalysis>.FindFreeIntKey(q, row => row.IdentificationUnitAnalysisID); }); }
public OperationsController( IQueryOperations operationQuery) { _operationQuery = operationQuery; }
/// <summary> /// Executes a query that allows traversing relationships and filtering by /// property values. /// Status codes: /// 200 (OK): Success. /// 400 (Bad Request): The request is invalid. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='querySpecification'> /// The query specification to execute. /// </param> public static QueryResult QueryTwins(this IQueryOperations operations, QuerySpecification querySpecification) { return(operations.QueryTwinsAsync(querySpecification).GetAwaiter().GetResult()); }
static Specimen() { Operations = new QueryOperations<Specimen>( //Smallerthan (q, spec) => q.Where(row => row.SpecimenID < spec.SpecimenID), //Equals (q, spec) => q.Where(row => row.SpecimenID == spec.SpecimenID), //Orderby (q) => q.OrderBy(spec => spec.SpecimenID), //FreeKey (q, spec) => { spec.SpecimenID = QueryOperations<Specimen>.FindFreeIntKey(q, row => row.SpecimenID); }); }
static Event() { Operations = new QueryOperations<Event>( //Smallerthan (q, ev) => q.Where(row => row.EventID < ev.EventID), //Equals (q, ev) => q.Where(row => row.EventID == ev.EventID), //Orderby (q) => q.OrderBy(ev => ev.EventID), //FreeKey (q, ev) => { ev.EventID = QueryOperations<Event>.FindFreeIntKey(q, row => row.EventID); }); }
static EventSeries() { Operations = new QueryOperations<EventSeries>( //Smallerthan (q, es) => q.Where(row => row.SeriesID < es.SeriesID), //Equals (q, es) => q.Where(row => row.SeriesID == es.SeriesID), //Orderby (q) => q.OrderBy(es => -es.SeriesID),//As EventSeries have negative Values Unlike the other entities in DiversityCollection we need to order by the nagtive value to get the same behaviour //FreeKey (q, es) => { es.SeriesID = QueryOperations<EventSeries>.FindFreeIntKeyUp(q, row => row.SeriesID);//CollectionEventSeries Autoinc-key is lowered by one by default in DiversityCollection. As we need to avoid Synchronisationconflicts we need to count in the other direction. }); }
static IdentificationUnit() { Operations = new QueryOperations<IdentificationUnit>( //Smallerthan (q, iu) => q.Where(row => row.UnitID < iu.UnitID), //Equals (q, iu) => q.Where(row => row.UnitID == iu.UnitID), //Orderby (q) => q.OrderBy(iu => iu.UnitID), //FreeKey (q, iu) => { iu.UnitID = QueryOperations<IdentificationUnit>.FindFreeIntKey(q, row => row.UnitID); }); }
static EventProperty() { Operations = new QueryOperations<EventProperty>( //Smallerthan (q, cep) => q.Where(row => row.EventID < cep.EventID || row.PropertyID < cep.PropertyID), //Equals (q, cep) => q.Where(row => row.EventID == cep.EventID && row.PropertyID == cep.PropertyID), //Orderby (q) => from cep in q orderby cep.EventID, cep.PropertyID select cep, //FreeKey (q, cep) => { //Not Applicable }); }
/// <summary> /// Execute an Analytics query /// </summary> /// <remarks> /// Executes an Analytics query for data. /// [Here](https://dev.applicationinsights.io/documentation/Using-the-API/Query) /// is an example for using POST with an Analytics query. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='appId'> /// ID of the application. This is Application ID from the API Access settings /// blade in the Azure portal. /// </param> /// <param name='query'> /// The query to execute. /// </param> /// <param name='timespan'> /// Optional. The timespan over which to query data. This is an ISO8601 time /// period value. This timespan is applied in addition to any that are /// specified in the query expression. /// </param> /// <param name='applications'> /// A list of Application IDs for cross-application queries. /// </param> public static QueryResults Execute(this IQueryOperations operations, string appId, string query, string timespan = default(string), IList <string> applications = default(IList <string>)) { return(operations.ExecuteAsync(appId, query, timespan, applications).GetAwaiter().GetResult()); }
static Localization() { Operations = new QueryOperations<Localization>( //Smallerthan (q, gt) => q.Where(row => row.LocalizationID < gt.LocalizationID), //Equals (q, gt) => q.Where(row => row.LocalizationID == gt.LocalizationID), //Orderby (q) => q.OrderBy(gt => gt.LocalizationID), //FreeKey (q, gt) => { //As there is no corredponding table in DiversityCollection we choose to count up to model a sequence gt.LocalizationID = QueryOperations<Localization>.FindFreeIntKeyUp(q, row => row.LocalizationID); }); }