Share on Twitter

While I was planning to write about the same topic and have the draft ready in my Windows Live Writer waiting to complete, I found an interesting question in StackOVerflow and couldn’t just resist to answer:

ORM/Persistence layer AdviceORM

The question starts with:

I’m starting a new project and I’m looking around for either a very good ORM or for a non-SQL-based persistence layer.

Then follows up with a REALLY GOOD summary of what he believes about each known ORM he knew out of his own findings and search. I advice you to go read it.

However, all this investigation didn’t get him to a single choice answer. And I can’t blame him. This is one fo the questions that will remain for so long without a single answer, or maybe having the popular “It depends” answer.

I have had a LONG research in this topic as well. I have read for so long (and watched videos/casts) to make sure of the best usage of many ORMs and then used them sometimes in test projects sometimes in production, and I wanted to share my thoughts based on this. I posted a long answer there on the question in StackOverflow, and I want to share this answer with you here. I may also have a second part of this post based on my existing Windows Live Writer draft, but, based on my previous times, I think I won’t!

, , , , , , , , , ,
Share on Twitter
Emad Ashi (@splashup on twitter) interviewed me in the 5th episode of his first Arabic podcast series DotNetArabi to talk about Object Relational Mapping in .NET in Arabic.
السلام عليكم
أصدقائي العرب ممن يتابعون هذه المدونة.. يسعدني أن أعلن عن أول حديث لي على الانترنت – و كذلك أول حديث لي على الانترنت بالعربية، عن الـ Object Relational Mappers – ORMs
شكرا جزيلا لـ “عماد العشي” (splashup@ على تويتر) على استضافته لي في موقع “دوت نت عربي DotNetArabi”، و هو موقع عربي يتضمن لقاءات صوتية مع العديد من المطورين في مجال الدوت نت، تماما على غرار DotNetRocks ، HanselMinutes و سواها، و هو في حد ذاته فخر لي أن أكون ضيفا للحلقة الخامسة في برنامج كهذا، خاصة عندما يكون ضيف أولى الحلقات هو عمر قعدان (omarq@ على تويتر).

الحلقة 5: محمد مليجي يتكلم عن الـ ORM (Object Relational Mapping)

وصف الحلقة من دوت نت عربي:
محمد مليجي تكلم عن الـ ORM (Object Relational Mapping) و هي برامج مساعدة تستطيع من خلالها نقل المعلومات و تحويلها من طبيعة قاعدة البيانات إلى طبيعة البرامج المبنية بأسلوب الـ Object Oriented. حلقة غنية بالتفاصيل و المعلومات القيمة جدا.
, , , , , ,
Share on Twitter

Allow me to quote here some emails I sent to the the Dot NET developers group in my company, Injazat, or, as we call ourselves, Ninjazat. I thought it’ll be useful to share some with you as well.

·         ASP.NET MVC – 20 Hours of FREE Video Tutorials

·         LINQ FAQ

o   LINQ FAQ for Newbie’s

o   LINQ FAQ Part 2

·         How we handle application configuration

·         ScottGu ASPNETMVC Session Video Available Now (Part 1/2 & 2/2)

·         Web Validation: Best Practices and Tutorials

·         Building a Single Sign On Provider Using ASPNET and WCF

o   Part 1

o   Part 2

o   Part 3

·         NxtGenUG Cambridge: Creating extendable applications using MEF slides and code

·         Dynamic Languages and .NET – Developer Day Scotland slides and code samples

·         patterns & practices: Data Access Guidance (VS 2010 Stuff)

·         Refactoring challenge

o   Part 1 – Examination

o   Part 2 – Preparation

·         LINQ is not LINQ To SQL

, , , , , , , , , , ,

YQL – Yahoo Query Language

Share on Twitter

Just in case you missed the news, Yahoo has created it’s own query thingy. No, no LINQ provider, it’s a “query language”. Check it out!

http://developer.yahoo.com/yql/

Quote:

What is YQL?

Yahoo! makes a lot of structured data available to developers, primarily through its web services. These services require developers to locate the right URLs and documentation to access and query them which can result in a very fragmented experience. The YQL platform provides a single endpoint service that enables developers to query, filter and combine data across Yahoo! and beyond. YQL exposes a SQL-like SELECT syntax that is both familiar to developers and expressive enough for getting the right data. Through the SHOW and DESC commands we enable developers to discover the available data sources and structure without opening another web browser.

How Do I Get Started?
  1. Check out the YQL Console.
  2. Read how to access YQL from your application.
  3. Get your Access Keys to sign your requests if you need them.
Usage limits

YQL has the following API usage restrictions:

Per application limit (identified by your Access Key):
  • 100,000 calls per day.
Per IP limits:
  • /v1/public/* 1000 calls per hour
, , , , ,
Share on Twitter

If you don’t know what eager loading is, Jump to “What’s eager loading?”.

Eager Loading Syntax

If you are eager loading Products for example in a typical (Categories 1<->* Products) relation, the standard syntax would like:

DbDataContext.Categories.Include(“Products”)

What is the problem with that?

The “Products” part. The word “Products” is a string. If I rename the Products table to ShopProducts or whatever or even remove it from this data diagram and have it elsewhere, or even something wrong happens and the relation is removed from DB/diagram by mistake, my code will still compile, but will fail when it runs. This is BAD BAD BAD.

How to solve this?

Since I always believe that if something exists somewhere you shouldn’t do it yourself unless its totally broken (and I mean REALLY REALLY BROKEN), I started searching inside the Entity Framework itself for something to get the entity name from.

At first it seemed super easy. Every entity class has a static property “EntityKeyPropertyName”, so, I thought I can write something like:

DbDataContext.Categories.Include(Product.EntityKeyPropertyName); // But this didn’t work

, , , , ,