[Solved] If C# attribute work like decorator design pattern?

You cannot compare these two things. Attributes are used to be accessed via reflection. They don’t change behaviour magically. You might probably (ab)use attributes to implement some kind of weird decorator design pattern. But just because an Attribute “decorates” e.g. a member, class, method or something, it has nothing to do with the decorator design … Read more

[Solved] How to delete a Product

Maybe you should first read the documentation of using CosmosDB: here On this page you can see how you can query your product and then delete this record from your collection: var query = client.CreateDocumentQuery<YourDocumentModel>(UriFactory.CreateDocumentCollectionUri(databaseName, collectionName), “<your sql>”, queryOptions); with this result you can update the object (yourDocumentModelObject) and remove the product from the subcategory. … Read more

[Solved] New class object error : Object reference not set to an instance of an object [duplicate]

This is your problem: _cache.TryGetValue(“CountsStats”, out countStats) out will change the object that countStats is pointing to. If it’s found in the cache, then it will be the cached object. Great! If it isn’t, then it will be null. You need to create a new instance in this case. You should change your code to … Read more

[Solved] Can’t use Count() in C#

Your resource is not a list but an object. Better implementation would be something like this. [HttpGet(“{id}”)] public IActionResult Get(string id) { using (var unitOfWork = new UnitOfWork(_db)) { var r = unitOfWork.Resources.Get(id); if (r == null) { return NotFound(); } return Ok(ConvertResourceModel(r)); } } 0 solved Can’t use Count() in C#

[Solved] occurred using the connection to database ‘ESCRestaurantDB’ on server ‘.\SQLEXPRESS’ [closed]

Now I haven’t computer with development enviroment with me to test, but I thing you forgot put return statment in opt lambda funtion: CreateMap<Item, ItemToReturnDto>() .ForMember(dest => dest.ItemImages, opt => {return opt.MapFrom(src => src.ItemImages); } If you could paste some more code of how you is call map funtion, we could help you. 4 solved … Read more

[Solved] Streaming large file across multiple layers

Found the solution by using HttpClient instead of RestSharp library for downloading the content directly to browser The code snippet is as below HttpClient client = new HttpClient(); var fileName = Path.GetFileName(filePath); var fileDowloadURL = $”API URL”; var stream = await client.GetStreamAsync(fileDowloadURL).ConfigureAwait(false); // note that at this point stream only contains the header the body … Read more