Posts tagged with C#

  • TDD with .NET Core and Visual Studio Code

    In this post we’ll see how to create a .NET Core solution with two projects with using nothing but the command line. Once that is setup, we’ll do a bit of TDD using Visual Studio Code.

  • Introducing generator-csharp-cli-app

    In the weekend I experimented with Yeoman and I created my first generator. This is also the first time I publish a package to the official npm repository, so double fun.

  • Using controllers with the same name in ASP.NET MVC

    How to use controllers that have the same class name but different namespaces in ASP.NET MVC.

  • Nested classes: Java vs C#

    So I have started reading up on Java. Getting reacquainted with that old friend. Playing with swing components on the UI editor of NetBeans. Reliving the horror of having to declare every exception your method might throw. The ugliness of the XML DOM API. object.setNumber(object.getNumber() + 1) and so on and so on.

  • Learn Java again

    I’ve been doing .NET for a long time. I started working on it exactly when .NET 2 was out, so I was lucky to avoid .NET 1 (almost) completely. I love .NET and C#. I think it’s not a coincidence that the main person behind it is the same person who was behind my favorite products when I was a teenage coder: Turbo Pascal, Object Pascal and Delphi. There is some sort of inexpressible similarity, I think, that reflects the designer’s choices in the framework and the language.

  • BlogEngine.NET MVC - Posts and Pages

    In the latest commit on BlogEngine.NET MVC, which is always available here, the following have been added:

  • BlogEngine.NET MVC - Login time

    It’s not difficult to implement a basic login system. BlogEngine.NET comes with its own membership and roles providers, so all we need to do is create a controller that uses the standard Membership features of .NET.

  • BlogEngine.NET MVC - Hello world

    So, to share a bit more of my excitement, here’s a screenshot of the classic ASP.NET and the MVC versions running side by side:

  • Extending NUnit: NUnit Companion

    I have several test fixtures (test classes) written in NUnit that verify my data layer works against a live database (MSSQL). By live I mean that there is no mocking or anything like that - that’s for the higher layers where I mock the data layer.

  • WCF and deferred execution - where is my Exception?

    A long time ago, I blogged about WCF and deferred LINQ queries and some surprises that combination may have. Back then, our WCF service would crash inexplicably when the returning type of an operation would contain an enumerable whose evaluation was deferred until after the WCF operation was out of scope.

  • Overriding EPiServer pages

    It is not very frequent or pretty but still sometimes it’s inevitable: we have to “steal” the code of EPiServer through Reflector/ILSpy/other and modify it to suit our needs. This way you can customize pages or user controls anyway you wish, beyond the way EPiServer allows through conventional channels.

  • WCF, JSON and the DateTime

    I’m playing with a WCF service that works with JSON. If you haven’t done this already, it’s fairly easy. In the web.config, make sure your service is using the webHttpBinding binding. Also you’ll need an endpoint behavior that looks like this:

  • MasterType directive and namespace conflicts

    Let me start by saying that I hope you won’t run into this one and that you probably won’t.

  • Exceptions using type initializer based singletons

    A popular web page describing how to implement a singleton in C# is this one, where several ways to implement a singleton are discussed. I usually pick the last option, which, according to the author of that page, has the most benefits. The author goes on to mention some problems that can occur if an exception is thrown in the constructor, but I never paid attention to that until recently.

  • How to use SQLite with Mono and Fluent NHibernate

    So I have setup my project playing nice in Windows .NET 4.0 with SQLite and Fluent NHibernate. I opened it up from my Mac to see if it would still work and, big surprise, it didn’t. It complained about System.Data.SQLite.dll not found, even though the dll was there.

  • Thread-safe code

    Consider this code:

  • SystemWebCompanion

    In many ASP.NET web applications, there are some small bits of code that you have to write over and over again. They’re too small so you never bother to refactor them out as a reusable dll. After all they are so small that it’s very fast to create from scratch again. They end up as a Utils.cs file somewhere in your project, probably repeated in all your projects in one form or another.

  • Deferred LINQ queries in WCF services

    Consider the following WCF service:

  • Playing with Castle DynamicProxy

    If you’ve ever used an ORM tool, such as NHibernate or the Entity Framework, you’ll probably have noticed that their goal is to be as unobtrusive as possible. They say, and I agree, that you shouldn’t be forced to have your business objects inherit from strange classes like MarshalByRefObject, or to annotate your properties with all sorts of ORM specific attributes. In that aspect, I find NHibernate to be rather clean.

This site uses third party cookies from Google Analytics and Google AdSense Accept and close popup