Also, do not miss to read Part 1 , Part 2 , Part 3 along with the above post.
Friday, April 25, 2008
Expression Trees from Basics
Also, do not miss to read Part 1 , Part 2 , Part 3 along with the above post.
Thursday, April 24, 2008
LINQ to SQL vs Entity Framework and LINQ to Entities
LINQ to SQL and the Entity Framework have a lot in common, but each have features targeting different scenarios in the Orcas timeframe.
LINQ to SQL has features targeting "Rapid Development" against a Microsoft SQL Server database. Think of LINQ to SQL as allowing you to have a strongly-typed view of your existing database schema. LINQ to SQL supports a direct, 1:1 mapping of your existing database schema to classes; a single table can be mapped to a single inheritance hierarchy (i.e., a table can contain persons, customers, and employees) and foreign keys can be exposed as strongly-typed relationships. You can build LINQ queries over tables/views/table valued functions and return results as strongly typed objects, and call stored procedures that return strongly typed results through strongly typed methods. A key design principle of LINQ to SQL is that it "just work" for the common cases; so, for example, if you access a collection of orders through the Orders property of a customer, and that customer's orders have not previously been retrieved, LINQ to SQL will automatically get them for you. LINQ to SQL relies on convention, for example default insert, update, and delete logic through generated DML can be overwritten by exposing appropriately named methods (for example, "InsertCustomer", "UpdateCustomer", "DeleteCustomer"). These methods may invoke stored procedures or perform other logic in order to process changes.
The Entity Framework has features targeting "Enterprise Scenarios". In an enterprise, the database is typically controlled by a DBA, the schema is generally optimized for storage considerations (performance, consistency, partitioning) rather than exposing a good application model, and may change over time as usage data and usage patterns evolve. With this in mind, the Entity Framework is designed around exposing an application-oriented data model that is loosely coupled, and may differ significantly, from your existing database schema. For example, you can map a single class (or "entity") to multiple tables/views, or map multiple classes to the same table/view. You can map an inheritance hierarchy to a single table/view (as in LINQ to SQL) or to multiple tables/views (for example, persons, customers, and employees could each be separate tables, where customers and employees contain only the additional columns not present in persons, or repeat the columns from the persons table). You can group properties into complex (or “composite”) types (for example, a Customer type may have an “Address” property that is an Address type with Street, City, Region, Country and Postal code properties). The Entity Framework lets you optionally represent many:many relationships directly, without representing the join table as an entity in your data model, and has a new feature called "Defining Query" that lets you expose any native query against the store as a "table" that can be mapped just as any other table (except that updates must be performed through stored procedures). This flexible mapping, including the option to use stored procedures to process changes, is specified declaratively in order to account for the schema of the database evolving over time without having to recompile the application.
The Entity Framework includes LINQ to Entities which exposes many of the same features as LINQ to SQL over your conceptual application data model; you can build queries in LINQ (or in “Entity SQL”, a canonical version of SQL extended to support concepts like strong typing, polymorphism, relationship navigation and complex types), return results as strongly typed CLR objects, execute stored procedures or table valued functions through strongly-typed methods, and process changes by calling a single save method.
However, the Entity Framework is more than LINQ to Entities; it includes a "storage layer" that lets you use the same conceptual application model through low-level ADO.NET Data Provider interfaces using Entity SQL, and efficiently stream results as possibly hierarchical/polymorphic DataReaders, saving the overhead of materializing objects for read-only scenarios where there is no additional business logic.
The Entity Framework works with Microsoft SQL Server and 3rd party databases through extended ADO.NET Data Providers, providing a common query language against different relational databases through either LINQ to Entities or Entity SQL.
So while there is a lot of overlap, LINQ to SQL is targeted more toward rapidly developing applications against your existing Microsoft SQL Server schema, while the Entity Framework provides object- and storage-layer access to Microsoft SQL Server and 3rd party databases through a loosely coupled, flexible mapping to existing relational schema.
Conclusion by me:
1. The big difference b/w LINQ to SQL vs Entity Framework is that the EDM is more flexible and more loosely coupled because of the 3-tiered model (conceptual layer, source schema and the mapping layer in between). For example, you could have one conceptual layer and then multiple mapping layers that point to mulitple databases. In LINQ to SQL, your dbml properties are tightly bound directly to one particular field in a table.
2. You can query entities using either Linq or Entity SQL (This can be either through the object services API or the Entity CLient, the one which gives you connections/commands and results in a dbDataReader).
Entity SQL, while not as elegant as using the strongly typed LINQ, has the advantage of enabling dynamic queries, since you use a string to build a query, much like TSQL.
Most Precious Gift : To be with my Angel !!!!
It is such a beautiful city i had never imagined of, specially during Spring its full of flowers along with the everlasting scenic beauty of sea shores, mountains and trees.
I just walk out of my apartment and look around, it gives me immense pleasure to be here.
This has been amazing experience of my life. I have realized few things which seems to be very important in one's life, if not to others at least to me they are.
The most precious gift was to have plenty of time to spend with my toddler boy.
I loved every moment here with him, i actually got to see him growing and learning new things.
I and my husband have been enjoying to find new games for him every day and have a feel to be a child again. Sometimes i think, there are so many crazy things which parents and child both can enjoy.
One day, my husband just picked up a balloon and started drawing something, my kiddo liked it so much that he would always ask him or me to draw all the animals (he knew) one after another.
Just to add, He has just turned two this April but knows so many animals, almost all the colors, basic shapes, 1-10 counting and A-Z alphabets, few words and few sentences. huh!!!!
He is bilingual, speaks Hindi and English (pronunciation is not very good though). I am sure, when i was two, i would hardly know half of he knows.
But yes, this Balloon drawing lasted very long, almost a month and he loved lion and elephant the most.
He loves reading books. He has almost 20 books, i never had that much, smile... He spend most of the time with books only at his day care. Also plays with blocks and go out, play with ball.
Spring has just started and we go out in the evening, mostly go to outside play area of the day care, my little boy goes to. Here are too many public play areas for children, so he has so many choices. He enjoys swings/slides ride there a lot.
Very recently, we discovered an interesting exercise for him when we were looking at the sky once. The clouds were so nice we just kept watching for few minutes and started to imagine different shapes in them. When we showed the same to our son, he was so delighted to see all the animals he always loved, by his imagination.
I would say, in India, it was impossible because the life would be so busy. In fact, i never had spent much time with my family (at least on weekdays). Most of the time goes in work place and traveling to work just because of traffic on roads.
Here, usual work time is 8am to 5pm (nice early to work and early to home tradition) and after that all time is yours. play, cook, eat and enjoy!!!!!
Thursday, April 17, 2008
DeepZoom in Silverlight 2.0
DeepZoom Composer: http://www.wintellect.com/cs/blogs/jprosise/archive/2008/04/01/silverlight-deep-zoom.aspx
Step-By-Step Video Using DeepZoom Composer: http://blogs.msdn.com/dawate/archive/2008/03/21/intro-to-silverlight-2-video-tutorial-deepzoom-for-dummies.aspx
Deep Zoom Collections Example: http://blogs.msdn.com/expression/archive/2008/03/22/deep-zoom-collections-example.aspx
Wednesday, April 16, 2008
Friday, April 11, 2008
ASP.Net Dynamic Data Support
- Automatically renders fully functional editable pages that are dynamically constructed from your ORM data model ('Linq to Sql' or 'Linq to Entity') meta-data.
- Provides automatic UI validation support based on the constraints set on your data model classes from the database, if not modified by you. These data constraints can be modified by extending a model class (implementing its partial class). No need to put validation checks in aspx code.
renames column UnitsInStock and defines range for it.
- Provides support for modifying field/page templates and also integrating third party templates (both field and page level) very easily.
[MetadataType(typeof(CategoryMetadata))]
public partial class Category
{
}
public class CategoryMetadata {
[UIHint("DbImage")]
public object Picture { get; set; }
}
Here Scott Hunter's talks about adding image support using DD field templates support.
- Watch this Video presented at MIX 08 for detailed introduction of Dynamic Data Support Feature.
- Also David Ebbo's blog mentions changes between Dynamic Data December Preview and April Preview.
Silverlight 2.0
- Great starting point with demos is Scott Guthrie's First Look at Silverlight 2.0
- An Excellent article on Unit Testing with Silverlight 2.0
- More Samples on Jeff Prosise's Blog
- Interesting links for Deep Zoom are Photosynth, Seadragon and Deep Zoom Composer. And also the BigPicture project from Vertigo that is used to give mousewheel support to Deep Zoom.
Other Resources:
Silverlight.net Forums
Microsoft’s Silverlight.net Community
Microsoft’s Silverlight product site
Scott Guthrie’s Silverlight tutorials and links
ASP.Net 3.5 MVC Framework
Good Resources:
- ASP.NET MVC Framework Roadmap at Scottgu's blog
- More Samples on Fredriks blog
- Thoughts on ASP.NET's New MVC Framework at Jeff Prosise's Blog
Wednesday, April 9, 2008
Common Google Search Keywords
1. Convert Currency
Suggested Search Keywords: convert 100 USD in indian rupees
2. Mathematical Calculations
Suggested Search Keywords: 1 ft in cm
3. Searching in a Specific Domain
Suggested Search Keywords: GetCurrentThread + site:*.microsoft.com
JQuery and ASP.Net
These tutorials cover the fundamentals of the jQuery library
- How jQuery Works by John Resig.
A basic introduction to jQuery and the concepts that you need to know to use it.
Tags: jQuery Core, Selectors, CSS, Traversing, Manipulation, Events, Effects
- Getting Started with jQuery by Jörn Zaefferer
Goes through the basics of jQuery, all the way up to building plugins.
Tags: jQuery Core, Selectors, Attributes, Traversing, Manipulation, Events, Effects, Ajax, Plugins
- Live Examples of jQuery by Cody Lindley
An interactive demonstration of the basics behind jQuery.
Tags: Selectors, Attributes, Traversing, Effects, Manipulation
There is a nice article on codeproject that helps you to get started using JQuery in your ASP.Net application, though it is ASP.Net 1.1 based but can be upgraded to ASP.Net 2.0 easily using vs2005.
Tuesday, April 8, 2008
ASP.Net 2.0 Security Videos
ASP.Net Books
- Essential ASP.NET by Fritz Onion: Focuses more on the underlying architecture. It has two flavors for a c# developer.
- Essential ASP.NET with Examples in C# (ASP.NET 1.1 but still useful)
- Essential ASP.NET 2.0
- ASP.NET 2.0 MVP Hacks: Describes in detail, how tricks might become creative solutions?
- Programming ASP.NET by Jesse Liberty and Dan Hurwitz
- Microsoft ASP.NET Coding Strategies with the Microsoft ASP.NET Team by Gibbs and Howard: Not really an introductory book.
- Programming Microsoft ASP.NET 2.0 Applications: Advanced Topics by Dino Esposito. As the title suggests, it’s not an introductory book. This is much more focused on topics such as building handlers and controls etc.