background preloader

.NET

Facebook Twitter

Entity framework 5.0 handle optimistic concurrency exception. Creating Sortable Objects with IComparable and Planning Your Interface Strategy. Practical .NET Creating Sortable Objects with IComparable and Planning Your Interface Strategy The IComparable interface lets you create objects that know how to sort themselves correctly.

Creating Sortable Objects with IComparable and Planning Your Interface Strategy

Entity Framework not picking up manual data changes in the DB - What's going on???? Hi, I'm working on an MVC site that uses EF for its backend DAL.

Entity Framework not picking up manual data changes in the DB - What's going on????

We're adhering to a repository pattern that separates concerns away from the site, so all the site is aware of is a single access point for all things data related. The problem we have is that whilst editing, updating etc from within the site is fine, if you manually edit a record in SQL, the changes are not reflected in the site. To illustrate the problem, I've put together a simple test app with only one table, using the same pattern that the larger site is following - First off, the EDMX As you can see, only one Table (customer). Inside the same project, we have an initialiser for the object data context: It does nothing but wrap the framework into a usable object - so the code isn't littered with "using(var _context = new DataContext())" Next, a generic repository pattern Finally the repository itself is created:

C# - Choosing the default value of an Enum type without having to change values. Introducing ASP.NET FriendlyUrls - cleaner URLs, easier Routing, and Mobile Views for ASP.NET Web Forms. Inversion of control - What is a composition root in the context of Dependency Injection. Jquery - Kendo UI Grid Error Message to Fadeout. Exception Handling in ASP.NET MVC. "THE ARTICLE IS NO LONGER MAINTAINED HERE.

Exception Handling in ASP.NET MVC

PLEASE POST ANY FURTHER DISCUSSIONS/QUESTIONS IN MY BLOG - Author Index Introduction.

ASP Web Form

Entity framework - EF Code First DBContext and Transactions. Design pattern – Inversion of control and Dependency injection. Updates added MVC and MVP design pattern tutorial date 19 december 2008 Table of Contents Updated Added link for how to do DI using Unity application bocks.

Design pattern – Inversion of control and Dependency injection

All about abstract classes. Introduction Abstract classes are one of the essential behaviors provided by .NET.

All about abstract classes.

Commonly, you would like to make classes that only represent base classes, and don’t want anyone to create objects of these class types. You can make use of abstract classes to implement such functionality in C# using the modifier 'abstract'. An abstract class means that, no object of this class can be instantiated, but can make derivations of this. An example of an abstract class declaration is: abstract class absClass { } An abstract class can contain either abstract methods or non abstract methods. Windows Communication Foundation – Resolving WCF service dependencies with Unity.

This series of posts will talk about Windows Communication Foundation, starting with an introduction into the technology and how to use it in you project, moving onto more advanced topics such as using an IOC container to satisfy dependencies in your services.

Windows Communication Foundation – Resolving WCF service dependencies with Unity

Posts in this series: In this post I am going to use Microsoft Unity Inversion of Control container to resolve the dependencies for the ProductService implementation. IoC Container Benchmark - Performance comparison - www.palmmedia.de. In this post I will do a performance comparison of the most popular IoC containers.Of course performance is not the only criteria when choosing a container for a project.

IoC Container Benchmark - Performance comparison - www.palmmedia.de

Perhaps you need features like interception or you develop for a specific platform, then not all containers are suited. But especially in high-load scenarios like a web application, a fast container can help you to serve more requests in the same time, so why not choose the fastest one? The test setup The contestants The number of available DI containers is quite big (see table below). The test setup. .NET Junkie - Writing Highly Maintainable WCF Services. The code supporting this article can be found at solidservices.codeplex.com . Most of my clients have maintainability issues with their software.

Almost always these problems are caused by improper software design. Incorrect design can have many causes, such as bad requirement analysis, and high pressure. Bad design can even cause more bad design and even bigger maintainability nightmares. When looking closely at such design, I often see a violation of the five basic design principles of object oriented design; the SOLID principles . JavaScript Modal Popup Window. Introduction Nowadays, JavaScript Modal Popup window has become an intrinsic part of Web based application.

JavaScript Modal Popup Window

Lately, I had a requirement where I needed to use Modal Popup Window. I Goggled for it and found many JQuery based Modal Popup Windows, but none of the code was fitting my needs. So I decided to create my own Modal Popup window without using JQuery which should be easy to use and is flexible. Using the Code First, you need include ModalPopupWindow.js file in your web page as given below: Visual Studio Visualizer: Part 1. Introduction Project website at: Add a Visual Studio Visualizer to look data from:

Visual Studio Visualizer: Part 1

Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application (9 of 10. The Contoso University sample web application demonstrates how to create ASP.NET MVC 4 applications using the Entity Framework 5 Code First and Visual Studio 2012.

Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application (9 of 10

For information about the tutorial series, see the first tutorial in the series. You can start the tutorial series from the beginning or download a starter project for this chapter and start here. If you run into a problem you can’t resolve, download the completed chapter and try to reproduce your problem. You can generally find the solution to the problem by comparing your code to the completed code.

For some common errors and how to solve them, see Errors and Workarounds. In the previous tutorial you used inheritance to reduce redundant code in the Student and Instructor entity classes. The Repository and Unit of Work Patterns The repository and unit of work patterns are intended to create an abstraction layer between the data access layer and the business logic layer of an application. Code First Approach using Entity Framework 4.1, Inversion of Control, Unity Framework, Repository & Unit of Work Pattern and MVC3 Razor View.

Download source - 7.2 MB Introduction In my previous article I discussed developing a simple, multi-layered architecture for a .NET application. However, there were few points that I skipped considering that the article was for beginners. When we talk about an application architecture there are certain points that need to be put into consideration before initiating. DBMapper - A new ORM tool. Download DBMapper.zip - 71.2 KB Introduction Hi, this article introduces DBMapper, a new ORM tool I have designed and developed. It's written on C# 3.5, and tested on Oracle 10g / 11g, Ms Sql Server 2005 / 2008 / 2012. JavaScript Best Practices. Introduction The use of JavaScript has exploded over time. Now it is practically unheard of for a website not to utilize JavaScript to some extent. As a web developer who has concentrated on back-end coding in C# and front-end look and feel via HTML and CSS, my skills in JavaScript evolved over time instead of by conscious effort.

"How to series" about MVC, jQuery, JSON, paging, mapRoute. Download source code - 2.49 MB Introduction Client side work has been very important because of large amounts of data in database systems. HTTP: The Protocol Every Web Developer Must Know – Part 1. LINQ to Twitter - Home.

C#

Database. Covariance and Contravariance FAQ - C# Frequently Asked Questions. In this post I’ll try to answer the most common questions I find on forums and in documentation feedback about C# covariance and contravariance. It’s a big topic for a single blog post, so expect to see a lot of “more information” links. Special thanks to Eric Lippert and Chris Burrows for reviewing and providing helpful comments.