יום שלישי, אוקטובר 28, 2014
Entity Framework is great. It allows parallelism. Application developer no longer needs to wait for the DB guy to design and implement a bunch of tables and stored procedures
For small software projects it really shines. You can implement a full production solution without even touch one line of SQL code.
Entity Framework offers 3 mode of operations
Selecting the appropriate mode is a matter of style and scenario.
For long, I preferred the Code First mode. It allows you to write clean POCO classes which are associated to the database tables. You can use this mode to connect to existing database...
יום ראשון, ספטמבר 21, 2014
I've been working with EntityFramework for more than 3 years and I love the technology. For many cases it simplifies the work of accessing the database.
It general, it is recommended to keep EntityFramework DbContext manipulation at the DAL level and not let it propagate to higher layers (BL and Presentation)
So, suppose I am using the repository pattern. The application does not access the DbContext object directly but rather is using a repository object which encapsulates all the data access logic. For example,
public class LoginRepository
public Login GetLoginByID(int loginId)
using (MyDbContext context = new MyDbContext())
var login = context.Logins.Where(l => l.ID == loginId).Single();
public void DeleteLogin(int loginId)
using (MyDbContext context = new MyDbContext())
var login = GetLoginByID(loginId);
This is quite a straightforward implementation. Let's use it from a Main method
static void Main(string args)
LoginRepository logins = new LoginRepository();
catch (Exception e)
Console.WriteLine("ERROR: " + e.ToString());
Surprisingly, the following error is reported
יום רביעי, יוני 6, 2012
A few days ago Microsoft released ASP.NET MVC 4 Release CandidateAs usual I was anxious to see what's new for the new release and quickly moved over the release notesGood news, Web API continues to evolve and coding web controllers looks even easierBad news, and this was quite a surprise for me, the "Single Page Application" project is no longer part of ASP.NET MVC 4. Not sure if it will be part of future MVC release. The official statement looks something like that: "SPA won’t ship with the final MVC 4 release, ...
יום שבת, דצמבר 24, 2011
This is quite an old topic but still when browsing through some popular forums I still encounter the following question: "How can I implement a table using DIVs and control the width of each column?"
Before digging into the implementation I would like to share my thoughts regarding the old TABLE vs. DIV war:In the old days web developers used TABLE tag for displaying a tabular data and for controlling the layout of the page.These days it seems as everyone hates TABLE and tries to use DIV instead for both tasks. I don't share the same feelings.I use TABLE for tabular...
יום חמישי, נובמבר 10, 2011
Does the following task sound familiar to you: "Upon work completion the system will send a notification e-mail to relevant recipients" ?
Two weeks ago I had a chance to implement this kind of scenario once again. Of course, part of the requirement is to send a very informative E-Mail which means sending not a plain text but rather an HTML. It goes like this:
Read the content of an E-Mail template file
Modify the template with real time information
Send the modified email to clients
Bullet #2 is not an easy one. You can use XSLT (if you are lucky enough to master it). Else, you...
יום שישי, אוקטובר 28, 2011
In my last ASP.NET MVC MSDN session I was asked a simple question: "How can we disable a filter for a specific action, assuming it is already defined at the class level?"
Of course, having this ability can really ease the maintenance of our application. Without this ability we need NOT to define the filter at the class level and then define at each action level.
Well, I did not have any simple question. However, I claimed that such an infrastructure can be easily developed using the excellent ASP.NET MVC extensibility support. Is that so? Let's try do it
Full sample code...
יום רביעי, ספטמבר 28, 2011
Two days ago I delivered another ASP.NET MVC 3 MSDN session.As usual, we started with the basics to allow engineers not familiar with ASP.NET MVC to understand the major concepts behind it
During the second part of the session, I demonstrated several subjects that are considered more advanced such as, Custom Action Result, Custom Model Binder, Custom Metadata Provider and other Custom XXXIn addition, I had the chance to introduce some really nice tools such as Knapsack and ASP.NET Mini Profiler
All samples which were presented during the session can be found at my SkyDrive public folders
I really enjoyed delivering this...
יום שישי, אפריל 22, 2011
Since 2005 I've been mostly working with Microsoft Team Foundation Server to manage my source code. Before that I had the chance to work with Microsoft Source Safe and even a bit with WinCVS (for self projects)
These days I am back again working on a self project and need to share my source code with two other developers. All roads led me to SVN.I was quite surprised how easily an SVN server can be installed and manipulated from Windows Explorer. So I decided to share this info with you.
There are several implementations of SVN server you can use. I...