Browse by Tags
All Tags »
.Net Framework 3.5 (
RSS)
As I already mentioned in one of my previous post , the SqlBulkCopy is a powerful tool which gives us an option to perform insertion for a large amount of data. The evolution of the ADO.NET creates us the Linq to Sql, as a great O/R Mapping framework from Microsoft kitchen. One of the missing features in Linq to Sql is the ability to use some bulk insert capabilities. In order to improve our Linq to Sql infrastructure I decided to implement the bulk insert as part of the Table class, and I will show...
For the last few weeks I was looking for a complete solution to implement LINQ to SQL in our system. Before I started the searching process I have defined to myself some basic requirements from it: · Rapid development in at least 80% of the cases. · Easy to use , understandable API. · Migration plain or good solution to work with our legacy code . · Easy to maintenance . · Testability framework! One of the major disadvantages of the LINQ to SQL framework is the difficult to test it. If you’ll try...
In the last few months I started to learn one of the great frameworks from Microsoft named LINQ. In order to get a better understand about the LINQ framework I read a lot from the official Microsoft documentation. I even shared people in my thoughts about the LINQ project (I focused on LINQ to SQL with its pervious name D-LINQ), in my blog . After a while I took a time to read the "Pro LINQ" book . This book exposes me to some fundamentals in the LINQ world which I wasn't familiar with...
Two team leaders in my workplace have arrived from TechEd Developers in Barcelona last week. They told me that Microsoft announce that the next release of Visual studio 2008 (aka "Orcas") and .Net framework 3.5 will take place at the end of this month! (The original release date was at February 2008). You can see this announce in the visual studio developer center main page : " Countdown to Visual Studio 2008 In his keynote address at TechEd Developers in Barcelona, S. "Soma"...
DLINQ is a great ORM engine with a lot of advantages. When I learned this tool I asked myself how I can look at the SQL code that it generates. At the beginning I did it by running my project in debug mode with a break point after the query statement. The SQL statement appears when we hover over the result object or by using the watch window. Debugging using the default hover debug tool Debugging using the watch window As you can see it isn't the most comfortable way to look at the generated SQL...
There are two approaches to work with the DataContext object. The first approach is to work with a single DataContext object which is responsible for all the quires and the manipulations in our system. In the second approach we work with several DataContext object. Each request refer to a single atomic operation and will work independency to others operation (The DataContext isn't aware to the previous operations at the current entity). The ASP.Net is a good example for the second approach because...
As I have mention before the DLINQ is a part of the ADO.NET family and this is a major reason for it to support transaction mechanisms. The DLINQ support the ADO.NET Transaction and the transaction scope. Let's see how we can use it at the following scenarios: ADO.NET Transaction At ADO.NET Transaction we have to handle the entire transaction process. It includes: opening a connection, starting the transaction, commit and rollback when needed, finish the transaction and close the connection. In a...
DLINK gives maximum flexibility in manipulation data with objects. You must retrieve the object before you update or delete it, and you must initialize a new object before inserting it into the db. Let's see some examples: Insert a new employee: MyDbDataContext db = new MyDbDataContext (); // Init a new employee object using Object Initializer Employee emp = new Employee () { Id = 10, Name = "New Employee" , DepartmentCode = 5 }; db.Employees.Add(emp); db.SubmitChanges(); You can see that I must...
In this post I'll focus on the query options in DLINQ. Let's take two simple scenarios: 1. Retrieve all the employees with the letter "a" in their first name. 2. Retrieve all employees in the "R&D" department There are three common ways to write these queries in DLINQ: 1. Using SQL syntax: The most simple (or maybe intuitive) way to write a standard query statement is by using the SQL syntax. For example, for the first scenario we should write a code like this: IEnumerable < Employee >...
One of the major parts in LINQ project is DLINQ – .Net L anguage In tegrated Q uery for relational D ata. DLINQ is a smart data access layer framework (component of the ADO.NET family), with an advanced runtime infrastructure and design time tools for managing data (queries and data manipulations) from a relational db as an object. The usage of this framework is very easy: The basic class in DLINQ is call "Entity class", each class represent a single database table. The properties in this class will...