Tagged pages

Found 7 articles tagged with Reflection

Super lightweight Data Access Layer returning models from ADO
Return strongly typed objects directly from stored procedure calls
Entity framework is an awesome tool for working with database in .net, but sometime you have to get back to old fashion ADO for the performances. The bad thing is that as soon as you get back to ADO, you have to deal with SqlDataReader, DataTable and DataSet classes. This is not so convenient for using in upper levels of applications, especially in MVC environment where using strongly typed objects is an essential thing. ... read more
Application plugin host with assembly caching and auto reloading
Caching and loading plugins dynamically when plugin library updates
Few moths ago I wrote and article about simple way to implement plugin architecture in C# simple plugin host application approach. This approach is great for desktop applications because when you for example need to update (which means replace the plugin dll) you can easily close the app and start it again and it will pickup new code. If you do not stop the application to replace the dll of plugin, you will not be able to replace the dll... read more
JavaScript Eval function equivalent in C#
Execute C# code string on the fly
Probably who ever was working on some complicated dynamic client-side JavaScript used at least once eval functional in JavaScript. Basically this function executes the code which is passed to it as parameter... read more
The server committed a protocol violation. Section=ResponseStatusLine
Switching off header validation in .NET
Recently I was adding GitHub project section to my blog when I run into the following exception "The server committed a protocol violation. Section=ResponseStatusLine" After some time of Google-ing I found few solutions, but the most simplest one was actually the best one... read more
Change Request.Form collection on the fly
How to modify Request.Form collection
Data from form are sent to backend (whether code behing of page in WebForms or Controller Action in MVC) in Request.Form property. It is oragnized as collection of name and value and can be easily access by name. In some extreme cases, you need to make some modifications to posted form data. ... read more
Access auto property backing field with reflection
Access property fields of auto property in C#
Using reflection you can easily access any property, filed, methods, pretty much anything of any type in .NET. Reflection is never the most elegant way to do something, but sometime you just have to do it. In older versions of C#, to declare a simple property in a class you would have to declare a private field which will be exposed by the property outside the class ... read more
Simple object mapper using reflection
Copy property values from one object to another using reflection
Dealing with models and POCO classes in MVC sometimes require to map properties from one object to another because they have some properties of the same name and type. This also can be a case when you are loading a model class from some other source and you need to transform it to your type with some additional properties, but also a bunch of properties with values from the source object instance. ... read more