|
|
Understanding Database Initializers in Entity Framework Code First |
|
Entity Framework Code First allows you to create data model classes prior to creating a database. When you run the application for the first time, a database is created for you on the fly based on the classes you created. Database initializers allow you to decide a strategy of database creation and seed data generation. Code First provides its own set of database initializer classes and also allows you to create your own. In this article you will learn to use the inbuilt database initializers in your application. You will also learn to create your own database initializers. Additionally, the article will illustrate how to populate a database with seed data during the initialization process. |
|
Posted On : 11 Feb 2012 |
|
|
Creating and Consuming Windows Communication Foundation (WCF) Data Services |
|
Windows Communication Foundation (WCF) Data Services allow you to create and consume services using Open Data Protocol (OData). In the process WCF data services allow you to access your data using REpresentational State Transfer (REST). This article gives you a jump start in creating and consuming WCF data services. It also shows how queries can be executed in asynchronous manner and illustrates how paged data can be dealt with. |
|
Posted On : 28 Sep 2011 |
|
|
Introduction to Entity Framework Code First |
|
Entity Framework (EF) allows you to program against a model instead of dealing with a database directly. In EF 4.0 (that ships with .NET 4.0) you typically design a model from an existing database visually, using a designer provided for that purpose. EF 4.1 builds on top of what EF 4.0 provided and allows you to create models directly at code level. That means instead of creating any database and then using a designer to define models, you create plain .NET classes and then use EF 4.1 techniques to make them EF models. This approach is referred as Code First because you focus on the source code of the model classes first. Once the models are ready Code First can also generate database tables out of those model classes. In this tutorial you will learn the basics of developing an application using Entity Framework Code First. |
|
Posted On : 20 Sep 2011 |
|
|
Working with Binary Large Objects (BLOBs) Using SQL Server and ADO.NET |
|
Sometimes, your data is not limited to strings and numbers. You need to store a large amount of data in a SQL server table. Documents, raw files, XML documents and photos are some examples. SQL sever provides special data types for such large volumes of data. In this article, I will discuss how to read and write Binary Large Objects (BLOBs) using SQL Server 2005 and ADO.NET. |
|
Posted On : 04 Aug 2008 |
|
|
Tip: Fetching Random Rows From SQL Server |
|
Recently I needed to fetch random rows from a SQL server table. If you have an integer column then using RAND() function goes well. However in my case there was no number column. |
|
Posted On : 23 Jul 2008 |
|
|
Working with the XML Data Type of SQL Server |
|
With the growing use of XML data, the need for the coexistence of relational data and XML data is also growing. The classic approach of storing XML data as physical disk files is unsuitable and tedious in many situations. No wonder modern database engines are geared to store XML documents right along with the rest of the relational data. To that end, the XML data type introduced in SQL Server 2005 is a great addition to the database engine. Prior to SQL Server 2005, developers often used VARCHAR or TEXT column types to store XML documents and fragments. Although this approach served well as far as data storage is concerned, it proved to be poor in terms of querying and manipulating the XML data. This article will give you a jump start in using the XML data type of SQL server and will teach you how XML data can be manipulated with the help of new XML Data Modification Language (XML DML). |
|
Posted On : 25 Jun 2008 |
|
|
Working with ADO.NET Schema APIs |
|
In majority of data driven applications developers deal with SQL queries that select, insert, update or delete data from the database. However, at times you need to retrieve schema information from the database. Suppose you are building applications that performs data import and export between two or more databases. As a good solution you would want to retrieve table schema at runtime rather than hard coding it. Luckily, ADO.NET provides a set of classes that allow you to query database schema. In this article I will illustrate how these classes work. |
|
Posted On : 25 Feb 2008 |
|
|
ADO.NET Trace Logging |
|
Tracing allows you to keep track of various events happening in the system. Tracing allows you to track the sequence of code execution along with the time taken for each step. Together, tracing can throw light on how your code is being executed and the performance of every step. Many real world applications are database driven and call for performance optimization of your data access code. Luckily, ADO.NET 2.0 provides built-in support for trace logging. The ADO.NET trace logging is tuned for performance and uses Event Tracing for Windows (ETW) providers. This article explains how you can configure the ADO.NET trace logging feature. |
|
Posted On : 05 Feb 2008 |
|
|
Distributed Transactions in .NET 2.0 |
|
Transactions are commonly used to update data as a batch. If any one operation from the batch is failed the entire batch of operations must be cancelled. Thus either all operations in the batch succeed or all of them are cancelled. ADO.NET 1.x provided SqlTransaction class that in conjunction with SqlConnection class provided to commit or rollback transactions. In .NET 2.0 an additional technique can be used and that is what is the topic of this article. |
|
Posted On : 08 Jul 2007 |
|
|
Copying bulk data into SQL Server |
|
Few weeks ago I (Bipin Joshi) released BinaryIntellect Bulk Copy Tool. Many visitors asked me how the tool is developed and hence I decided to write this article. Though the tool uses many other aspects of ADO.NET 2.0 the core thing is the new bulk copy class. Some applications require inserting huge data to SQL server databases. In such case executing independent INSERT queries is not an efficient way. SQL Server data provider allows you to perform such inserts using SqlBulkCopy class. This article explains with an example how this class can be used in your applications. |
|
Posted On : 26 Dec 2005 |
|
|