Mar
31
2010

XPO from the beginning, Part 1, Basic Information

User Rating: / 4
PoorBest 

I was doing a screencast with Mehul Harry for the DX Channel and it came to mind that in all the blogs / videos etc, there isn’t anything on actually starting I haven't really covered XPO from the Basics. So I am here to correct it ;)

There is of course plenty of resources for you to find information such as the helpful getting started tutorials provided by DX Documentation, the DX Community Forum for XPO (which a wealth of knowledge), the DX Search System, and following Gary Short's Blog (XPO/XAF Evangelist with DevExpress)

So I have planned to create an 8 part series, and this is the plan

Part 1, Basic Information
Gives you some background into what XPO is, what XPO does, why use XPO and where to get XPO

Part 2, Getting Started
We will create a simple demo project and import a basic Access database for a template schema, we will then add a couple of properties and a new class and look at the database XPO generates.

Part 3, How to “dress” your persistent class
We’ll go through the Attributes provided by XPO, such as Relations and Calculated fields and extend the classes we made in Part 2

Part 4, How to access your data, filtering and save, delete operations
Now we have some kick ass classes in XPO we need to know how to Create it, Read it, Update it and Delete it

Part 5, Using XPO to display data, Binding using the Visual Designer
We will build upon the demo project and show how to create a form and use the designer to bind a grid to a list of objects, then do a simple detail form to bind some text boxes etc to a single object.

Part 6, Using XPO to display data, Binding using Code
Using the forms we created in Part 3 we will take out the Visual Designer based components and use code to generate

Part 7, Simplified Criteria Syntax, XPO_EasyFields
How to use XPO_EasyFields to obtain Intellisense access to your PropertyNames for use in Criteria and DataBinding

Part 8, LINQ to XPO
In all seriousness, I have been stuck in the .NET 2 world so LINQ is new to me, but lets explore XPO’s LINQ capabilities.

So lets get started on Basic Information…

Basic Information

What is XPO?

XPO (short for eXpress Persistent Objects) is a DevExpress component that is apart of the DXperience subscription. The documentation does provide some good information, however sometimes people do have problems finding it, I hope this provides you some pointers.

XPO is an ORM (Object Relational Mapping)  component

What is ORM? Well I will leave that up to Wikipedia to explain it in detail, however, in a nutshell it’s where as a programmer, you work with classes within your project and leave the ORM do all the SQL CRUD (Create, Read, Update Delete) statements with your database.

What is the advantage of using XPO?

  •  
  • XPO provides many advantages, to list some major points:

  • The developer programs with strongly typed objects, this leads to less runtime errors and faster programming

  • Some ORM’s work by using Code Generators to build a Class for the programmer, XPO instead by using a combination of Class/Property Attributes and a clever DataLayer allows you to specify a class and specify how you want it to be Persisted, this allows the developer to perform certain data logic within the Class itself

  • The programmer doesn’t have to know the specifics about the database system in use, such as the differences between types or functions available, as XPO will convert the coded objects into valid SQL for the database

  • The programmer isn’t locked to a particular database system, for example the programmer could have an application built around a legacy database such as Access, then later, migrate it to MS SQL, PostgreSQL, MySQL etc. and only changes a few lines of code

  • Updates to the database schema are handled by XPO, so if the developer adds new properties to the projects classes, XPO will update the database to include them.

    Note: There is a current limitation where XPO only adds columns/tables, if the programmer changes a datatype of a property or removes a property, they will need to manually handle the change in your database.

  • There are many more, but to keep it brief, it is the fastest, most reliable way to create a database application ;)

What databases are supported for XPO?

DevExpress within it's documentation lists the following 14 databases:

  • Advantage
  • Asa
  • Ase
  • DB2
  • MS Access
  • MS SQL Server
  • MS SQL Server CE
  • MySQL
  • Oracle
  • Pervasive
  • PostgreSQL
  • SQLite
  • VistaDB

Already have a database and want to import it?

DevExpress documentation has a great article which steps the developer through how to import your current database schema. Note: The existing table MUST have a Primary Key column.

How do I get XPO?

If you do .NET development and don’t use DevExpress components you are really putting yourself at a disadvantage, XPO is included in the Enterprise and Universal subscriptions, so I would suggest looking at the offerings to see what’s best for you. I will add that the other benefit of these subscriptions is they include CodeRush which is a god send to increase your productivity within Visual Studio (plugins and templates you will find on my site all relate to CodeRush)

That’s it for Part 1

I hope this gives you a good intro into XPO, I will post Part 2 in the coming week. If you are confused or need more information please don’t hesitate to leave a comment and I will be happy to help.

Comments  

 
0 # Jim Clay 2010-03-31 08:53
Michael - GREAT idea. I think this will be a great resource for everyone and a place to for many things to be added. When you get to part 3 - some of my favorite addributes are: Size(SizeAttrib ute.Unlimited), DeferredDeletio n(False), Persistent("...."), Indexed(Unique: =True), PersistentAlias .

These are some of my more commonly used ones. It will be interesting to see what others use.

Jim
Reply | Reply with quote | Quote
 
 
0 # Michael Proctor [Dx-Squad] 2010-03-31 09:19
Thanks for the comments Jim.

Certainly those Attributes will be included, I aim to have a "list" of possible attributes in 2 categories, Everyday and Advanced

So the Persistent, NonPersistent, Indexed, Association, Size etc are Everyday but things like DeferredDeletio n, MapInheritance etc are Advanced)

All attribute will be included so what you listed plus

NoForeignKey, Key, NonPersistent, Delayed, Association, MapInheritance, Custom, DbType, OptimisticLocki ng, DisplayName and ValueConvertor.

Mainly I will link to the Documentation but will give each a summary/use case, so you can have a complete list of available Attributes in one page. (I will skip NullValue as it is more for .NET 1 where there isn't Nullable types)

I think I have given myself a task bigger than Ben Hur but the advantage will be that I can refer back to it in the Community Forums and also if I do put on an employee to bring them up to speed ;)
Reply | Reply with quote | Quote
 
 
0 # Gary Short 2010-03-31 18:59
Hi Michael,

This great! It's good to see our customers getting so enuthiastic about XPO. Just a slight correction though, there is documentation on getting started with XPO, it's in the "Getting Started" section here: http://www.devexpress.com/Help/Content.aspx?help=XPO&document=CustomDocument2263.htm

Really looking forward to seeing what you come up with though. Give me a shout if you need any info.
Reply | Reply with quote | Quote
 
 
0 # Michael Proctor [Dx-Squad] 2010-03-31 19:22
Thanks for dropping by Gary, I see your point, I have modified the post to reflect the meaning I was trying to convey
Reply | Reply with quote | Quote
 

Add comment

Although I believe your free to say what you want, please don't abuse either myself or other peoples, be constructive.


Security code
Refresh

Should AussieALF stay bald?




Results

Latest Comments

My Twitter

Follow me on twitter