InternetException

ASP.NET

ASP.NET · 10 posts (all categories)

Enhancing your .NET API with query language

· 1690 words · ~8 min read · updated · in .NET, ASP.NET, Hamster Wheel

#NuGet #LINQ #API design #HLinq

What is query language? SQL is Structured Query Language and you use it to query your database for data you are interested in. It does not have to do anything with your API. If you ever were working with big XML files you probably used XQuery or XPath, query languages designed to XML for data. There are specialized languages that are designed to work with APIs to query them for data. For example, you probably heard about GraphQL or even used it when you were working with some API.

Read the whole thing →

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 →

Owin model and Kestrell request handling

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

  • OWIN - Open Web Interface for .NET
  • allows web apps to be decoupled from web servers
  • defines standard way for middleware to be used in a pipeline to handle requests and provide responses
  • ASP.NET Core applications can interoperate with OWIN-based applications, servers and middleware

Microsoft.AspNetCore.Owin package provides two adapter implementations:

  • ASP.NET Core to OWIN
  • OWIN to ASP.NET Core

This allows ASP.NET Core to be hosted on top of an OWIN compatible server/host or for other OWIN compatible components to be run on top of ASP.NET Core.

Read the whole thing →

Ninject and WCF

· 817 words · ~4 min read · updated · in .NET, ASP.NET

#Ninject #WCF #API design

Ninject is very simple and in the same time powerful IoC container. I used it in few project and had very little or none problems. Most of the time getting instances from Ninject kernel requires simple line with binding expression, or even this is sometime unnecessary if type is self bind able (i.e. if it is concrete class with parameterless constructor). Little harder is getting Ninject to work with WCF. You cannot just bind interfaces types because proxies which implements them are created through .NET mechanism. Luckily WCF system is very flexible and mostly can be changed/extended with custom functionality.

Read the whole thing →

Server controls in separete assembly part 2

· 795 words · ~3 min read · updated · in .NET, ASP.NET, C#

Yesterday I was writing about creating server controls in separate assembly . Today I will cover more complicated example then simple “Hello World!” control. My goal was to create text box that will take handler method to run when validation event will be triggered, and when validation fail will show appropriate message. Text box with builtin validation would be nice, since you always should validate user input , right? But lets start creating our control.

Read the whole thing →

Server controls in separate assembly

· 394 words · ~1 min read · updated · in .NET, ASP.NET, C#

In my project I wanted to create text box control with builtin configurable validation. ASP.NET definition in .aspx or .ascx file would get validation function by name. But I do not wanted to create just .ascx file with text box. I could not then reuse that control in other projects and it certainly would be nice, right? Creating such server control from code is not hard, but maintainability of HTML code in C# (it cannot be done other way) is not good. It’s pain really. Why Microsoft would create way to automatically create C# code from .ascx, .aspx files is mystery for me.

Read the whole thing →

Better algorithm for finding UpdatePanel that will be updated during page request.

· 496 words · ~2 min read · updated · in .NET, ASP.NET, C#

#UpdatePanel

Other day I was experimenting with finding which UpdatePanel will be updated during page post back. I found out that my solution was not working correctly for complex triggers, like user controls with custom events, which will trigger async postbacks and update of panel. Or for grids with buttons. It was big issue. Also it was not pointing to correct UpdatePanel if name of control was not entirely unique (for example when you have multiple same custom controls on page). It would return first panel, even if it wasn’t updating.

Read the whole thing →

Display message on client from anywhere in code with ASP.NET

· 890 words · ~4 min read · updated · in .NET, ASP.NET, C#

#UpdatePanel

When I was working with WinForms application in previous work I have found one of most useful feature, ability to show some message to the client. For example user cannot edit some entity in particular time (it is being edited by someone else) or should change password because it will expire in x days. I wanted to do something similar in my web application.

Read the whole thing →