850 likes | 1.17k Views
Generator. All information's of PLINQO in this Document, I got it from:. http://www.codesmithtools.com/plinqo. So, you could visit the link above to research. 1. Introduce CodeSmith generator - PLINQO. 2. 3. 4. What is PLINQO for NHibernate ?. Key features PLINQO for Nhibernate .
E N D
All information's of PLINQO in this Document, I got it from: http://www.codesmithtools.com/plinqo So, you could visit the link above to research
1 Introduce CodeSmith generator - PLINQO 2 3 4 What is PLINQO for NHibernate? Key features PLINQO for Nhibernate. Getting Started Steps PLINQO for Nhibernate.
1 Introduce CodeSmith generator - PLINQO PLINQO is an enhanced alternative for the most popular Object Relational Mapping frameworks. It is a set of CodeSmith Templates designed to simplify the creation and maintenance of data models, as well as provide you with an easy to use data access layer that adhears to best practices.
Microsoft's minimalist approach to ORMs, LINQ to SQL is the original lightweight LINQ implementation for data access.
Entity Framework is Microsoft's ORM of choice. It is an advanced framework that uses multiple models to allow for flexibility.
NHibernate is the open source community's ORM of choice. It is a port of Hibernate for Java that has taken on a life of it's own.
Instant Data Layer Generation Safe Regeneration and Synchronization Open Source 1.1 1.3 1.2 Key Features:
Instant Data Layer Generation 1.1 PLINQO will generate all of your database mappings, business entities, and query extensions instantly. Each generated class is separated into editable and generated files, all of which are organized into an intelligible folder structure.
Safe Regeneration and Synchronization 1.2 Quickly and safely regenerate your data layer against your database. PLINQO intelligently seeks out and merges data changes with code changes, allowing you customize your ORM mappings and safely regenerate them!
Open Source 1.3 All PLINQO templates and libraries are open source. This puts you in complete control of your source code, and allows you to customize your data layer to fit your needs. Interested in sharing your changes? Submit a patch and get it put into the next build of PLINQO
2 What is PLINQO for NHibernate? • PLINQO NH is a Replace and Enhance alternative to NHibernate. • PLINQO NH is available in C#, and supports SQL Server, Oracle, DB2, MySQL, and more!
2 What is PLINQO for NHibernate? PLINQO is a set of CodeSmith Templates that generate ORM (Object Relational Mapping) frameworks using consistent design patterns and best practices. PLINQO Frameworks also include an advanced set of features to both simplify and optimize the task of data access.
2 What is PLINQO for NHibernate? Advantaged: - simplifications - optimizations - convenience The ultimate goal is to take the best of both worlds and put them together into a robust framework that is easy to use. Without write CRUD (Create, Retrieve, Update, Delete) Method
3 Key features PLINQO for Nhibernate. PLINQO can generated your HBM files, entity classes, and all NHibernate configuration in seconds. It then allows you to safely regenerate that code at anytime, thus synchronizing your mappings with the database while still intelligently preserving custom changes.
3.1 3.2 3.3 3.4 3 Key features PLINQO for Nhibernate. Data Layer Generation Safe Regeneration Intuitive File Structure Query Logic
3.1 Data Layer Generation • Generate your HBM files from your database. • Supports Tables, Views, and Stored Procedures. • Supports associations and composite keys. • Generate your Entities from your HBM files.
3.2 Safe Regeneration • Safely regenerate your data layer against your database. • Intelligently seeks out and merges data changes with code changes. • Ability to filter what gets updated from the database.
3.3 Intuitive File Structure • Each generated class is separated into editable and generated files. • Complex types are generated into an organized folder structure.
3.4 Query Logic • Generates chainable query extension methods that simplify query logic. • Query extensions support advanced comparison and containment operators.
4.1 4.3 4.2 4 Getting Started Steps PLINQO for Nhibernate. How to install CodeSmith Generation Quick Start Manual Configuration
4.1 How to install CodeSmith Generation Download latest: http://code.google.com/p/codesmith/downloads/list?can=3&q=nhibernate Getting Started: http://docs.codesmithtools.com/display/NHibernate/Getting+Started Documentation: http://docs.codesmithtools.com/display/NHibernate/Home Additional download and samples: http://docs.codesmithtools.com/display/NHibernate/Downloads
4.1 How to install CodeSmith Generation • These templates are dependent on the following: • Development Applications: • CodeSmith Generator Professional 5.x • Microsoft Visual Studio 2010 • Runtime Assemblies: • .NET 4.0 • NHibernate 3.2.0.GA
I downloaded and installed CodeSmith Generator 6.0
4.2 Quick Start Open QuickStart.cst Select a SourceDatabase. Click Generate! See details in the next slide
Double click on the CodeSmith Generator Explorer Icon see the Code Smith Generator Explorer dialog
Database Picker here Database Solution Data Project Web Project Test Project
I use Petshop database to demo The Category table will be use (3 columns)
Click Test button to test connecting Name: define name Provider Type: SqlSchemaProvider Connection String: use to connect to SqlServer, string connect as the same in the .Net. So you could copy & paste from .Net
When select Datasource from Database picker, You will see the result in the left slide You could change location DataContext here Now, click Generate button
In the E:/example folder In the Petshop.Data, open Petshop.Data.csproj
Right click on the Petshop.Data.csp and choose Generate Outputs
Take the tour Generate : References Entities Maps Models Queries EntityBase DataContext
Maps: Entities Columns in table Functions Store Procedure Views View in database
Maps: Entities Columns in table
Maps: Functions Store Procedure
Maps: Views View in database
EntityBase PetshopDataContext
Petshop.UI Open Web.config, you will see connectionStrings tag as below: I add new WebForm1.aspx to test
Petshop.UI Right click on Project / Add new Item/ WebForm