Archive

Archive for August, 2011

Meet us at Visual Studio Live – Redmond

August 22, 2011 Leave a comment

SoftFluent sponsors Visual Studio Live!, taking place in Redmond WA from October 17th to the 21st. If ever you happen to attend the event, this could be a great opportunity to have a chat together ;)

image

See you there!

Arguments in CFQL

August 19, 2011 Leave a comment

CFQL methods can take arguments. Arguments in CFQL are composed of an optional type name and a name.

If the type name isn’t specified CodeFluent Entities looks for a property in the current entity matching the argument name.

For instance, instead of writing:

<Product>
  <Id />
  <Code />
  <Price />
 
  <cf:method name="LoadByCode" body="load(string code) where Code = @code" />
</Product>

You can write:

<cf:method name="LoadByCode" body="load(Code) where Code = @Code" />

Note: CFQL is case insensitive, writing “Code” or “code” or “LOAD” or “load” doesn’t matter.

This actually allows you to write flexible models: since if you change the property type, you won’t have to update your methods.

Keeping the same concern in mind, you can write expressions using entity names instead of their keys, such as:

<cf:method name=”LoadByRole” body=”load(Role Role) where Role = @Role” />

This should be preferred to writing methods such as this one:

<cf:method name=”LoadByRole” body=”load(guid roleId) where Role.Id = @roleId” />

The result will indeed be the same, however, if you change the type of the Role identifier, or if you update the Role entity to have a composite key your code will break. To the contrary, using the first method using the “Role = @Role” statement will keep on working.

CodeFluent Query Language Overview

August 18, 2011 3 comments

CodeFluent Query Language (CFQL) is a simple yet powerful language which allows developers to write stored procedures in their models. Therefore, CFQL is platform independent and its producers which will translate this query into an actual stored procedure.

The language itself is a mix of traditional SQL and object-oriented syntaxes (btw, the language is case insensitive):

<method> (<arguments>) [from <source>] [<where> <expression>] [<order by> <expression>]

Available methods are:

  • Load / loadone: creates a procedure to return one or multiple instances from the database,
  • Search: similar to load methods, however arguments are optional/nullable, supports wildcards (e.g. ‘*’), and the resulting SQL is built dynamically at run time in order to support as many optional parameters as you desire,
  • Count: return a number being the result of the count operation (uses the count SQL clause),
  • Delete: allows developers to delete batches of records from the persistence layer (and avoid doing deletes in a foreach)
  • Raw: allows developers to specify custom persistence code because CFQL does not intend to replace persistence code, so you can’t do everything with it.

Modeler Hot Keys

August 17, 2011 1 comment

Using the Modeler, a graphic interface to CodeFluent Entities integrated to Visual Studio 2008 & 2010, several hot keys are available to ease developers’ life while designing their model.

 

CTRL + Click on a relation property

Clicking on a relation property whilst holding the CTRL key down zooms on the referenced entity and surrounds it with an animated red square so you can easily spot it:

 

SHIFT + Click on a property

Clicking on a property whilst holding the SHIFT key down allows you to create relations. Holding SHIFT while selecting a property makes an arrow appear which you can use to point to another property or entity.

Once you pointed to the referenced entity/property, the “Add New Relation” dialog will appear so you can define the relation’s multiplicity (One-To-One, One-To-Many, Many-To-One, Many-To-Many)

 

CTRL + Scrolling with the mouse wheel

Holding the CTRL key and scrolling with the mouse wheel lets you zoom in or out where the mouse points. It’s dead simple, yet so convenient!

 

CTRL + Dragging anywhere on the surface

Doing so allows you to zoom in a specific area. CTRL + dragging will make a dashed rectangle appear symbolizing the area in which the Modeler should zoom in:

Converting an existing CodeFluent Entities project to the new Visual Studio CodeFluent Entities format (.cfxproj) –Part 2

August 16, 2011 Leave a comment

In a previous post we introduced how to convert a former CodeFluent Entities project into a Modeler one. What is said in this previous post is still valid, nevertheless, a quick update can be done as the convert form is now directly included in Visual Studio.

  • Start Visual Studio, and go in File > Project > New…
  • Select CodeFluent Entities, and the Legacy Model template,

image

  • Make the Package Path point to your source model
  • Set your project path to the Target Directory Path and hit Next.

image

 

And that’s it your done! A new cfxproj was created and opened in Visual Studio.

Using the Property Grid in a CodeFluent Entities Project

August 12, 2011 1 comment

All Visual Studio developers are familiar with the Property Grid which allows developers to view and edit all properties of the currently selected object.

The Modeler provides its own, available when editing a Surface or the XML, and which is organized into three views:

  1. Default view
  2. Advanced view
  3. Aspects and Producers view

You can switch from one view to another using their corresponding button available at the very top of the property grid.

 

The Default View

In the default you’ll find all “common” properties, those most frequently used.

DefaultView

 

The Advanced View

The advanced view provides access to all other properties. Properties available in this view are optional and provide extra features you can set on the currently selected element.

AdvancedView

 

The Aspects And Producers View

Finally, this view allows developers to access extra-properties brought by aspects and producers which were added to the project.

AspectsAndProducersView

Meet us at DevConnections Las Vegas

August 11, 2011 Leave a comment

SoftFluent sponsors DevConnections Las Vegas, taking place in from October 31st to November 3rd 2011.

 

We’ll hold a booth over there, so come have a chat with us!

CodeFluent Entities – License

August 10, 2011 Leave a comment

CodeFluent Entities is activation-based, meaning that the first time you launch the product you’re going to have to activate your product.

A dialog will pop-up asking for your license key.

Your license key is available on your “My Account” page on www.codefluententities.com.

Activation requires an internet connection as the product connects to our servers to validate the license key. If for some reason you can’t contact our server due to some network settings, you can also activate by email as explained here.

After activating once, your licensing information is cached per Windows user, so you don’t have to type your license key over again.

Then, whenever activating is needed, that is to say:

  • when installing a new CodeFluent Entities version,
  • for a new Windows user,
  • on a license change (e.g. upgrading from a Professional to a Ultimate)

The product will activate using your cached license key.

Note: You can disable automatic activation and switch it to manual using the SoftFluent.Licensing.Client.exe.

Categories: Presentation Tags: ,

CodeFluent Entities & Bitness

August 9, 2011 2 comments

First, we need to distinguish two different environments:

  • at modeling time: during developments, when building your model,
  • at run time: the built application.

 

At Modeling Time

  • The Modeler runs in 32-bit mode exclusively: this is due to the fact that the Modeler is an extension of Visual Studio which is a native 32-bit process,
  • All other tools provided (.exe) both have 32-bit and native 64-bit binaries versions available,
  • All tools can run with 32-bit WoW64 on 64-bit machines
  • Some producers are supported in 32-bit mode exclusively like the SQL Server Producer v1.

 

At Run Time

Regarding run time, generated applications are completely “bitness agnostic”: using CodeFluent Entities you can create 32-bit, 64-bit, or “Any CPU” applications. By the way, this is possible because CodeFluent Entities run time assemblies are compiled as “Any CPU” so it’ll use the bitness of the built application (x86 or x64) or the bitness of the target machine if your application is built in “Any CPU”.

What’s the Entity Display Name?

August 8, 2011 1 comment

Having a look to what the WPF Smart-Client Producer generates (producer is still in Beta), you’ll note that the generated screens have their comboboxes directly bound to entity instances without any extra-code:

<ComboBox ItemsSource=”{Binding  Source={StaticResource CustomerCollectionLoadAll}}”
SelectedItem=”{Binding Path=Customer}” />

So, one might ask how does it know which property value to display?

You’ll notice that in the generated Business Object Model, all entity classes are decorated with the following attribute:

[System.ComponentModel.TypeConverterAttribute(typeof(CodeFluent.Runtime.Design.NameTypeConverter))]

As you can see a TypeConverter is specified, and it is set to be the NameTypeConverter provided by the runtime.
The NameTypeConverter provides a simple type converter to display a name for any object.

To do so, it uses the IDisplayable interface, or the ICodeFluentEntity interface or ultimately searches for a property called DisplayName or Name.
It also just so happens that all CodeFluent Entities generated classes implement the ICodeFluentEntity interface which provides a property named EntityDisplayName.

As documented here, by default, the EntityDisplayName of an entity is the first string property declared after the identifier.
However, if ever the collectionKey attribute is used on one of the string typed properties, it will use this collection key.
Finally, you can define the EntityDisplayName property yourself by setting the entityDisplay XML attribute (Is Entity Display in the modeler) on your desired property.

Follow

Get every new post delivered to your Inbox.

Join 49 other followers