accepted
|
To run a single instance of application in C#. Following code snippet can be usefull.
|
Thursday, January 17, 2013
Run single instance of app in c#
Wednesday, August 29, 2012
ENTITY FRAMEWORK LESSION 1.
Microsoft entity framework is ORM (object relation mapping)
that enables developer to work
with relational database and domain sepecific objects.It
skips the code that we was writing in earlier times to get data from database.
Now developers issues queries using LINQ, then retrieve and manipulate the data
as strongly typed objects.ORM implementation provides services like: change
tracking, identity resolution, lazy loading and query translation. Now
developers only need to focus on business logic rather than fetching data from
database.
It is an enhancement to ADO.NET that gives developers an automated
mechanism for accessing & storing the data in database and working with the
results in addition to DataReader and DataSet.
O/RM includes three main parts: Domain class objects,
Relational database objects and Mapping information on how domain objects maps
to relational database objects (tables, views & storedprocedures). ORM
helps us to keep our database design separate from our domain class design.
This makes application maintainable and extendable. It also automates standard
CRUD operation (Create, Read, Update & Delete) so developer doesn’t need to
write it manually.
here are many ORM frameworks for .net in the market like
DataObjects.Net, NHibernate, OpenAccess, SubSonic etc . ADO.NET Entity
Framework is from Microsoft.
Differences between entiry framework and LINQ to sql
1.Entity framework supports not only SQL Server but also
other database like Oracle, DB2, MySQL etc.
2.Most of the time L2S classes must be one-to-one with
database objects e.g. Customer class can be mapped only with Customer table. On
other hand in Entity Framework we can map domain class with multiple tables
using various inheritance strategies like table per type (class) or table per
hierarchy of classes etc.
3. We can also follow mutliple techniques using entity
framework like code first, model first or database first. Now no longer dependencies on old techniques.
4. In upcoming products microsoft also giving support and
integration of entity framework.
ENTITY FRAMEWORK ARCHITECHTURE (GOT FROM A ANOTHER WEBSITE
IT IS NOT MINE):
Following figure shows the overall
architecture of the Entity Framework. Let’s see each component of the
architecture:
EDM (Entity Data Model): EDM consist three main parts- Conceptual model, Mapping and
Storage model.
Conceptual Model: Conceptual model is our model classes and their
relationships. This will be independent from our database table design.
Storage Model: Storage model is our database design model which includes
tables, views, stored procedures and their relationships and keys.
Mapping: Mapping consist information about how our conceptual model
is mapped to storage model.
LINQ to Entities:LINQ to Entities is query language used to write queries
against the object model. It returns entities which are defined in the
conceptual model. We can use your LINQ skills here.
Entity SQL: Entity SQL is again a query language same as LINQ to
Entities. However it is little more difficult than L2E and also developer need
to learn it separately.
Object Service: Object service is a main entry point for accessing data from
database and to return it back. Object service is responsible for
materialization which is process of converting data returned from entity client
data provider (next layer) to an entity object structure.
Entity Client Data Provider: The main responsibility of this layer is to convert L2E or
Entity SQL queries into SQL query which is understood by underlying database.
It communicates with ADO.Net data provider which in turn sends or retrieves
data from database.
ADO.Net Data Provider: This layer communicates with database using standard
ADO.Net.
I'll do more posting on this topic very soon, because entity framework 4.5 is knocking the door. :)
Friday, August 17, 2012
ASP.NET 4.5 Web Pages 2
New features include the following:
1. New and updated site templates.
2. Adding server-side and client-side validation using the Validation helper.
3. The ability to register scripts using an assets manager.
4. Enabling logins from Facebook and other sites using OAuth and OpenID.
5. Adding maps using the Maps helper.
6. Running Web Pages applications side-by-side.
7. Rendering pages for mobile devices.
2. Adding server-side and client-side validation using the Validation helper.
3. The ability to register scripts using an assets manager.
4. Enabling logins from Facebook and other sites using OAuth and OpenID.
5. Adding maps using the Maps helper.
6. Running Web Pages applications side-by-side.
7. Rendering pages for mobile devices.
8. The configuration logic For MVC applications has been moved from Global.asax.cs to a set of static classes in the App_Start directory. Routes are registered in RouteConfig.cs. Global MVC filters are registered in FilterConfig.cs. Bundling and minification configuration now lives in BundleConfig.cs
9. Publishing of the project come under the project from solution explorere, It is removed from the top menu. Now whole setting can be done by right click on the project and set the publish settings.
When you open a Visual Studio 2010 SP1 Web project for the first time in Visual Studio 11 Beta, the following properties are added to the project file:
FileUpgradeFlags
UpgradeBackupLocation
OldToolsVersion
VisualStudioVersion
VSToolsPath
FileUpgradeFlags, UpgradeBackupLocation, and OldToolsVersion are used by the process that upgrades the project file. They have no impact on working with the project in Visual Studio 2010.
VisualStudioVersion is a new property used by MSBuild 4.5 that indicates the version of Visual Studio for the current project. Because this property didn’t exist in MSBuild 4.0 (the version of MSBuild that Visual Studio 2010 SP1 uses), we inject a default value into the project file.
9. Publishing of the project come under the project from solution explorere, It is removed from the top menu. Now whole setting can be done by right click on the project and set the publish settings.
When you open a Visual Studio 2010 SP1 Web project for the first time in Visual Studio 11 Beta, the following properties are added to the project file:
FileUpgradeFlags
UpgradeBackupLocation
OldToolsVersion
VisualStudioVersion
VSToolsPath
FileUpgradeFlags, UpgradeBackupLocation, and OldToolsVersion are used by the process that upgrades the project file. They have no impact on working with the project in Visual Studio 2010.
VisualStudioVersion is a new property used by MSBuild 4.5 that indicates the version of Visual Studio for the current project. Because this property didn’t exist in MSBuild 4.0 (the version of MSBuild that Visual Studio 2010 SP1 uses), we inject a default value into the project file.
Extract to user control
In large web pages, it can be a good idea to move individual pieces into user controls. This form of refactoring can help increase the readability of the page and can simplify the page structure. This is similiar to "Extract to metho" functionality which is available in 3.5 onwards. So "Extract to User Control" is available in .net 4.5.
The VSToolsPath property is used to determine the correct .targets file to import from the path represented by the MSBuildExtensionsPath32 setting.
There are also some changes related to Import elements. These changes are required in order to support compatibility between both versions of Visual Studio.
The VSToolsPath property is used to determine the correct .targets file to import from the path represented by the MSBuildExtensionsPath32 setting.
There are also some changes related to Import elements. These changes are required in order to support compatibility between both versions of Visual Studio.
Configuration Changes in ASP.NET 4.5 Website Templates
The following changes have been made to the default Web.config file for site that are created using website templates in Visual Studio 2012 Release Candidate:
In the <httpRuntime> element, the encoderType attribute is now set by default to use the AntiXSS types that were added to ASP.NET. For details, see AntiXSS Library.
Also in the element, the requestValidationMode attribute is set to "4.5". This means that by default, request validation is configured to use deferred ("lazy") validation. For details, see New ASP.NET Request Validation Features.
The <modules> element of the section does not contain a runAllManagedModulesForAllRequests attribute. (Its default value is false.) This means that if you are using a version of IIS 7 that has not been updated to SP1, you might have issues with routing in a new site. For more information, see Native Support in IIS 7 for ASP.NET Routing.
In the <httpRuntime> element, the encoderType attribute is now set by default to use the AntiXSS types that were added to ASP.NET. For details, see AntiXSS Library.
Also in the
The <modules> element of the
Subscribe to:
Posts (Atom)
