Skip to main content

Posts

NHibernate.MappingException: No persister for: Sample.Product

After creating a new mapping file using the code mapping feature in NHibernate, it didn’t work when I tried to persist an instance of the object. Instead I got the following error message: NHibernate.MappingException: No persister for: Sample.Product Here is the mapping file I’m using: Do you notice what’s wrong? …. I forgot to make my mapping class public: public class ProductMapping: ClassMapping<Product>

Visual Studio 2017–SQL Server Data Tools- Custom assemblies could not be loaded

On one of my SQL Server Reporting Services reports, I had to use some custom logic. Instead of embedding the code directly into the report, I decided to create a separate assembly which makes it easier to test and debug this code. After importing the assembly in my Visual Studio 2017 Reporting Services project, I couldn’t load the Report Designer preview window anymore. Instead I got the following error message: An error occured during local report processing. The definition of the report ‘/samplereport’ is invalid. Error while loading code module: ‘Sample.Barcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Details: Could not load file or assembly ‘Sample.Barcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The system cannot find the file specified. To fix this I had to copy the DLL to the following location: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\SSRS ...

Windows Identity Foundation - Using a machine key to encrypt/decrypt your session token

By default WIF uses a built-in SessionSecurityTokenHandler to serialize the session token to and from the cookie. Behind the scenes this tokenhandler uses the Data Protection API (DPAPI) to protect the cookie material. DPAPI uses a key that is specific to the computer on which it is running in its protection algorithms. For this reason, the default session token handler is not usable in Web farm scenarios because, in such scenarios, tokens written on one computer may need to be read on another computer. As a solution you can switch the default SessionSecurityTokenHandler by a machine key based alternative: After doing that, there is one extra step required. The default IIS configuration autogenerates a machine key per application pool. To generate a specific key and copy it to all server instances on your web farm, remove the checkboxes next to the ‘Automatically generate at runtime’ option and choose Generate Keys from the action menu on the right. Now you can copy and ...

F# 4.5–The ‘match!’ keyword

F# 4.5 introduces the match! keyword which allows you to inline a call to another computation expression and pattern match on its result. Let’s have an example. Here is the code I had to write before F# 4.5: Notice that I have to bind the result of callServiceAsync before I can pattern match on it. Now let’s see how we can simplify this using the ‘match!’ keyword: When calling a computation expression with match! , it will realize the result of the call like let! . This is often used when calling a computation expression where the result is an optional .

Service Fabric Troubleshooting guides

“With great power comes great responsibility.” Although this quote had nothing to do with Service Fabric, it could be applicable there as well. Service Fabric brings the power of PaaS close to you, unfortunately it does come with its own set of problems and difficulties. And once you get stuck there isn’t much information out there to help you find a solution (ask me how I know). One of the resources that helped me a lot were the Service Fabric Troubleshooting guides , these are the same guides used by the Azure Customer Support Services and Product Group Site Reliability Engineers. It’s a combination of guides, troubleshooting tips and scripts that can help you find the root cause of your Service Fabric related problems. A must have for every Service Fabric administrator(and developer).

ASP.NET Web API–Batch requests

Did you know that ASP.NET Web API allows you to batch requests? Batching packs several API requests together and send them in one HTTP request. The responses will be grouped in one single HTTP response as well. There isn’t much you need to do to configure this on the server, just add a specific route to your route table with batching enabled: The important things to notice are the following: The DefaultHttpBatchHandler executes each request sequentially, but in case you don’t have any dependency between requests, you can set a property to make execution non-sequential. The MapHttpBatchRoute route template can contain parameters. So, in case you create your own batch handler, you can pass in parameters to it. If you don’t need the sequential behavior you can create your own HttpBatchHandler and override the execution order property: That’s all that is required to enable batching on the server. Let’s now see how to use this on the client: This is a little known fea...

Error when building Reporting Services project

After opening an ‘old’ Reporting Services project, we got the following exception message when we tried to build the report: Custom parameter layout was detected in the report. SQL Server 2014 Reporting Services and earlier do not support custom parameter layout. Either reduce the error level to a value less than 3 or change the TargetServerVersion to a version that supports custom parameter layout. To fix this error, you have to go to the Report properties: Right click on your Reporting Services Project , and choose Properties . Change the TargetServerVersion to SQL Server 2016 or later