Close

AFAS Online

I have already written a few posts on AFAS Online. Below you will find a query example. I also like to share a very helpful link, which explains for example how you can apply filtering on multiple fields and with different query operations. Also note you will always have to include take, otherwise no results…

NuGet package CsvHelper

I came across an interesting NuGet package named CsvHelper. CsvHelper basically let’s you create a Csv file from a typed list. You can choose whether or not to include a header automatically. As an example, let’s say you access AFAS to get a list of users. private static async Task<List<ASB_Totara_User>> GetAfasUserAsync(Logging logging) { string take…

Convert local time to UTC

Sometimes you find yourself struggling with a datetime issue. This time I simply used DateTime.ToUniversalTime() at first, but that didn’t work for me. So, I decided to specifically include the time zone. I am in Amsterdam, so I tried to use the official Central European Summer Time (CEST) zone. Bad luck again. In C# you…

Asynchronuous Processing

Asynchronuous processing is a feature you might not use that often. Below link explains the concept: Link: Asynchronuous Programming. I needed the asynchronous call in an Azure function. More specifically I had to trigger a logic app for four different regions. I found however that if one of the regions failed, the processing of the…

Using Views in Entity Framework

I had an issue when accessing a view via Entity Framework. After some research I found a blog that exactly described my issue: In the example there’s a view that returns the following data when called from SQL Server: Country Year TotalSales Philippines 2010 20.000000 Philippines 2011 40.000000 Now, let’s look at the generated class…

Entity Framework Joins

In a previous post we saw that it is recommended to use navigation properties in Linq to SQL. But, what if you don’t have navigation properties and still want to join two tables? The answer is in the question: use the join operator. Below is the query that I built. Note that I want to return…

Call assembly that uses EF

I wanted to call an ExceptionHandler in a helper class. The ExceptionHandler uses Entity Framework to store the error. Then I tried to call the ExceptionHandler from a Logic App. The Logic App selects data, but does so via ADO.Net and not via the Entity Framework. The first error I received is that the EF…

EF query cannot return complex type

Another error you can recieve from the Entity Framework is the following: The entity or complex type <complex type> cannot be constructed in a LINQ to Entities query Here is the query that I used and didn’t work: List<ProcessDefinition> entries = (from PD in contextCommon.ProcessDefinitions where PD.Process.SourceSystem == sourceSystem && PD.Process.MessageType == messageType && PD.Process.ResolveProcess…

EntityValidationErrors in Entity Framework

After executing an Entity Framework query, I received the following error: Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details. This is a very generic exception that didn’t gave me a clue what the problem was. I following a recommendation to add an exception handler for type DbEntityValidationException. This exception revealed…