version 11.1.0
hello I have created a new localisation file in Danish xxx-da.xml and added to folder. I works fine in debug and on test server (azure), but not in production. Do you have a hint on what could be the issue?
Thank you,
hi, Yes - doing so, I only get related tenant data.
hi
The MetricRecords does not function as you might remember, as the serilization fail because of class member of type object (sql_variant).
MetricHead:
[Table("MetricHead")]
public class MetricHead : Entity<int>, IMustHaveTenant, IMayHaveOrganizationUnit, ISoftDelete
{
public string MetricId { get; set; }
public int DataType { get; set; }
public int TenantId { get; set; }
public long? OrganizationUnitId { get; set; }
public string GroupId { get; set; }
public string MetricName { get; set; }
public string DeviceId { get; set; }
public string LocationName { get; set; }
public string UserLabel { get; set; }
public string UserNote { get; set; }
public string ObjectProperties { get; set; }
public short LogType { get; set; }
public short Unit { get; set; }
public int Scale { get; set; }
public string BrickLocation { get; set; }
public string BrickMeasurable { get; set; }
public string BrickEquipment { get; set; }
public string BrickPoint { get; set; }
public string BrickRelationships { get; set; }
public string BrickTag { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public DateTime CreatedUTC { get; set; }
public DateTime UpdatedUTC { get; set; }
public long UpdatedByUserId { get; set; }
public bool IsDeleted { get; set; }
public short LogPeriod { get; set; }
public int? Plan { get; set; }
public string DecimalDegree { get; set; }
public double? Latitude { get; set; }
public double? Longitude { get; set; }
public double? Altitude { get; set; }
public List<MetricRecords> MetricRecords { get; set; }
public MetricHead()
{
}
}
And MetricRecords:
[Table("MetricRecords")]
public class MetricRecords : Entity<long>, ISoftDelete
{
public MetricHead MetricHead { get; set; }
[Column("RecordValue", TypeName = "sql_variant")]
public object RecordValue { get; set; }
public byte RecordValueDataType { get; set; }
public DateTime RecordUTC { get; set; }
public long CreatedByUserId { get; set; }
public bool IsDeleted { get; set; }
public MetricRecords()
{
}
}
Thanks,
MVC verions v11.1.0
Hello I have implemented the Odata like this:
[AbpAuthorize] public class MetricHeadController : AbpODataEntityController<Metric.MetricHead>, ITransientDependency { public MetricHeadController(IRepository<MetricHead> repository) : base(repository) { } }
In startup:
services.AddMvc().AddOData(opts => { var builder = new ODataConventionModelBuilder(); builder.EntitySet<Metric.MetricHead>(nameof(Metric.MetricHead)).EntityType.Expand().Filter().OrderBy().Page().Select(); builder.EntitySet<Metric.MetricRecords>(nameof(Metric.MetricRecords)).EntityType.Filter().OrderBy().Page().Select(); opts.AddRouteComponents("odata", builder.GetEdmModel()); });
However - I get data from all tenants when quering.
What could be wrong? Thank you,
When using OData with Microsoft Powerbi - Microsoft propose different authenticationmethods: https://docs.microsoft.com/en-us/azure/devops/report/powerbi/client-authentication-options?view=azure-devops
What do you suggest using in Aspnetzero MVC / Multitenant setup? Thanks, Thøger
thank you - i was hoping that implementing that additional odata controller would do the job, however I still get a strange problem when i use expand to include records from related table.
My odata request looks like this: https://localhost:44302/odata/MetricHead?$filter=MetricId eq '7000007112.netatmo_1.02:00:00:00:73:82.States/Temperature'&$Expand=MetricRecords($top=10)
But the result is terminated just as the related data should come i MetricRecords array:
{"@odata.context":"https://localhost:44302/odata/$metadata#MetricHead(MetricRecords())","value":[{"MetricId":"7000007112.netatmo_1.02:00:00:00:73:82.States/Temperature","DataType":10,"TenantId":31,"OrganizationUnitId":null,"GroupId":"4","MetricName":"States/Temperature","DeviceId":"netatmo_1.02:00:00:00:73:82","LocationName":"Ude2","UserLabel":"Udeklima2","UserNote":null,"ObjectProperties":null,"LogType":2,"Unit":9,"Scale":0,"BrickLocation":"NA","BrickMeasurable":"Temperature","BrickEquipment":"Meter","BrickPoint":"MISSING","BrickRelationships":null,"BrickTag":null,"CreatedUTC":"2022-02-08T13:53:30.877+01:00","UpdatedUTC":"2022-03-29T19:23:30.8124695+02:00","UpdatedByUserId":85,"IsDeleted":false,"LogPeriod":60,"Plan":1,"DecimalDegree":"9.478276638304067,55.260628687395695","Latitude":null,"Longitude":null,"Altitude":null,"Id":7443,"MetricRecords":[
I do net get any errors: INFO 2022-04-02 16:14:54,252 [orker] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished HTTP/1.1 GET https://localhost:44302/odata/MetricHead?$filter=Id%20eq%206748&$expand=MetricRecords($top=10)%0A - - - 200 - application/json;+odata.metadata=minimal;+odata.streaming=true 13643.9946ms;
(My MetricHead do have Expand in options) Do you have an idea? Thank you
ASP.NET CORE MVC & jQuery .NET 6.0 v11.1.0
hi Your class: public abstract class AbpODataEntityController<TEntity> : AbpODataEntityController<TEntity, int> where TEntity : class, IEntity<int> { protected AbpODataEntityController(IRepository<TEntity> repository) : base((IRepository<TEntity, int>)repository) { } } is locked to int. But we have an entity with id of type long - and therefore cannot create a controller for that entity. What can we do?
Thanks,
hi Thanks - removing microsoft.visualstudio.azure.containers.tools.targets package did the job kind regards, Thøger
hi yes - please see this:
Build started... 1>------ Build started: Project: Visility.Core.Shared, Configuration: Release Any CPU ------ 2>------ Build started: Project: Visility.GraphQL, Configuration: Release Any CPU ------ 3>------ Build started: Project: Visility.Web.Mvc, Configuration: Release Any CPU ------ 3>Visility.Web.Mvc -> D:\one\OneDrive\projects\Cloud\cloud\src\Visility.Web.Mvc\bin\Release\net6.0\Visility.Web.Mvc.dll 4>------ Publish started: Project: Visility.Web.Mvc, Configuration: Release Any CPU ------ Determining projects to restore... Restored D:\one\OneDrive\projects\Cloud\cloud\src\Visility.EntityFrameworkCore\Visility.EntityFrameworkCore.csproj (in 2,26 sec). Restored D:\one\OneDrive\projects\Cloud\cloud\src\Visility.Core.Shared\Visility.Core.Shared.csproj (in 2,26 sec). Restored D:\one\OneDrive\projects\Cloud\cloud\src\Visility.GraphQL\Visility.GraphQL.csproj (in 2,26 sec). Restored D:\one\OneDrive\projects\Cloud\cloud\src\Visility.Application\Visility.Application.csproj (in 2,26 sec). Restored D:\one\OneDrive\projects\Cloud\cloud\src\Visility.Core\Visility.Core.csproj (in 2,26 sec). Restored D:\one\OneDrive\projects\Cloud\cloud\src\Visility.Application.Shared\Visility.Application.Shared.csproj (in 2,26 sec). Restored D:\one\OneDrive\projects\Cloud\cloud\src\Visility.Application.Internal\Visility.Application.Internal.csproj (in 2,26 sec). Restored D:\one\OneDrive\projects\Cloud\cloud\src\Visility.Jobs\Visility.Jobs.csproj (in 2,7 sec). Restored D:\one\OneDrive\projects\Cloud\cloud\src\Visility.Web.Core\Visility.Web.Core.csproj (in 3,46 sec). Restored D:\one\OneDrive\projects\Cloud\cloud\src\Visility.Web.Mvc\Visility.Web.Mvc.csproj (in 4,15 sec). C:\Users\visil.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.14.0\build\Container.targets(149,5): Error CTC1003: Visual Studio container tools require Docker to be running. C:\Users\visil.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.14.0\build\Container.targets(149,5): Error MSB4018: The "KillAppInsideContainer" task failed unexpectedly. System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\one\OneDrive\projects\Cloud\cloud\src\Visility.Web.Mvc\obj\Container\ContainerToolsExceptions.json'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost) at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at Microsoft.VisualStudio.Containers.Tools.Tasks.ContainerBuildTask.OutputAndLogContainerToolsException(ContainerToolsException ex) at Microsoft.VisualStudio.Containers.Tools.Tasks.ContainerBuildTask.<EvaluateBuildPrerequisitesAsync>d__27.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Containers.Tools.Tasks.ContainerBuildTask.<ExecuteAsync>d__26.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Containers.Tools.Tasks.ContainerBuildTask.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
4>Build failed. Check the Output window for more details. ========== Build: 3 succeeded, 0 failed, 7 up-to-date, 0 skipped ========== ========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
And in addtion the error list:'
Severity Code Description Project File Line Suppression State Error The "KillAppInsideContainer" task failed unexpectedly. System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\one\OneDrive\projects\Cloud\cloud\src\Visility.Web.Mvc\obj\Container\ContainerToolsExceptions.json'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost) at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at Microsoft.VisualStudio.Containers.Tools.Tasks.ContainerBuildTask.OutputAndLogContainerToolsException(ContainerToolsException ex) at Microsoft.VisualStudio.Containers.Tools.Tasks.ContainerBuildTask.<EvaluateBuildPrerequisitesAsync>d__27.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Containers.Tools.Tasks.ContainerBuildTask.<ExecuteAsync>d__26.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Containers.Tools.Tasks.ContainerBuildTask.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() Visility.Web.Mvc 0 Error Visual Studio container tools require Docker to be running. Visility.Web.Mvc 0