InternetException

reflection

reflection · 10 posts (all tags)

HLinq design

· 4639 words · ~23 min read · in .NET, ASP.NET, Hamster Wheel

#LINQ #delegates #reflection #Entity Framework

A bit of history

I remember the day when I started writing the HLinq query language. It was weekend and I was experimenting with writing Single endpoints for Hamster Wheel. Single endpoints were almost done and next step was to write List endpoint. This would allow to get list of records of specific type. After I got single GET returns correct data for chosen record id, list should not be hard to implement. Then just create, update and delete. Basic CRUD API in Hamster Wheel would be finished. I was thrilled that I actually was able to do such thing.

Read the whole thing →

.NET/C# interview questions

· 146 words · ~1 min read · updated · in .NET, interview

#generics #reflection #async #Entity Framework

Read the whole thing →

Reflection

· 20 words · ~1 min read · in .NET, interview

#reflection

obtain information about types and members at runtime create instances, invoke or access them dynamic code generation Further read: https://learn.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/reflection

Genereting proxies during runtime using Reflection.Emit

· 4156 words · ~20 min read · updated · in .NET, C#, WCF

#reflection #self-hosting #delegates #XAML

Reflection.Emit is very powerful tool. It creates IL code and since C# is converted into IL too, we have the same functionality as in C# and even more. It is very powerful and at the same time very complicated. Because of that it is worth to discuss how and for what it should be used. One idea is to create dynamic code with automatic implementations of interfaces - proxy types.

Read the whole thing →

Faster than Reflection: Delegates. Part 3.

· 6868 words · ~34 min read · updated · in .NET, C#

#delegates #reflection #generics #NuGet

This is third article in series, that explains how to create delegates for public and non-public members of public, non-public or not known in compile-time types. If you are not familiar with previous articles and looking for detailed explanation of how delegates works, how they are created and why, I strongly encourage you to read first two. If you are just looking for a way to create delegates for methods or constructors it is not necessary. Code with new features and with bug fixes is available on GitHub and as Nuget package.

Read the whole thing →

Faster than Reflection: Delegates. Part 2.

· 5330 words · ~26 min read · updated · in .NET, C#

#delegates #reflection #NuGet

This is second article in series, that explains how to create delegates for public and non-public members of public, non-public or not known in compile-time types. If you are not familiar with previous article and looking for detailed explanation of how delegates works, how they are created and why, I strongly encourage you to read it first. If you are just looking for a way to create delegates for methods or constructors it is not necessary. Last article in series you can find here . Code with new features and with bug fixes is available on GitHub and as Nuget package. In previous article and first one in series, we covered:

  1. Static
    1. Properties
    2. Fields
  2. Instance
    1. Properties
    2. Fields
    3. Indexers

Now it is time to cover following members.

  1. Static
    1. Methods
  2. Instance
    1. Methods
    2. Constructors

Read the whole thing →

Faster than Reflection: Delegates. Part 1.

· 10477 words · ~52 min read · updated · in .NET, C#

#delegates #reflection #NuGet

This article is first part of the series of three. Next ones you can find here and here . Code for all three articles, with new features and bug fixes is available on GitHub and as Nuget package.

Why not Reflection?

If you working with .NET and C# (probably other languages too), at some point, you will have to write more advanced and generic code, that i.e. reads all properties of a type, searches for attributes, etc. Or maybe you want to call some private method or property? It is not that rare to use some internal mechanism of framework or library. Usually, the first solution involves Reflection. But the thing is: Reflection is slow. Of course, it is sufficient if you need to use Reflection rarely and it is not the main code of the application. If it is used more often at some point, you will probably try to optimize it. And now is the fun part: how to do it?

Read the whole thing →

ViewFactory for Xamarin application

· 5652 words · ~28 min read · updated · in .NET, Android

#delegates #reflection #async #XAML

First things first - Why?

First of all I do not like how creating of views and navigation works in Xamarin. There is much boilerplate needed to just navigate from one page to another. Typically like in Xamarin documentation we have to obtain INavigation interface instance, create instance of a new page, create instance of view model and all dependencies it requires. When you page do not require view model things are real easy and Xamarin sample is just enough.

Read the whole thing →

Entity Framework Patterns extension and Unit Test in Visual Studio 2012

· 646 words · ~3 min read · updated · in Entity Framework, Visual Studio

#Unit tests #reflection #NuGet #Ninject

Yesterday I was trying to make work simple test class in VS2012. I did not know what was wrong exactly. It was first project when I tried to glue together Entity Framework with repository pattern and Ninject as IoC container. Because of the fact that this was first time for solution like that I was sure that it is me, or rather source of my problem was indeed my code. But let’s not skip ahead.

Read the whole thing →