Archive for January, 2012

CodeFluent Entities: Using your application in SharePoint 2010

January 25, 2012 1 comment

SharePoint 2010 provides a great feature named the Microsoft Business Connectivity Services (BCS) (formerly known as the Business Data Catalog in SharePoint 2007).  SharePoint’s BCS enables users to read and write data from external systems from within SharePoint 2010 and to do so you need to create an External Content Type to bring external data in SharePoint. Once you have an external content type, you can use it with any of the various presentation features of Business Connectivity Services such as external lists, external data columns, and external content controls for Office applications.

External Content Types can be created from databases, WCF services or a .NET assembly, and it just so happens CodeFluent Entities can generate any of the three, therefore using SharePoint’s BCS feature you can, without a single line of code, consume your application in SharePoint 2010!

Form a bird’s-eye view here’s how to do it:

Create Your Application

Nothing specific there: use CodeFluent Entities to design your application and generate the code!

For this post, we used:

  • the SQL Server Producer to generate the database,
  • the Business Object Model Producer to generate our .NET classes,
  • the WCF Service Producer to generate our WCF services and contracts,
  • the Template Producer to generate our WCF configuration file, as well as SVC files to host our services in IIS.



Create an External Content Type

As a data source to our external content type we used our WCF services so that manipulating data in SharePoint still uses our business logic and we don’t have to deploy our dll in SharePoint.

Here’s how how to do it: How to create an External Content Type based on a Web Service.



Create an External List in SharePoint

Once you have your External Content Type, still using SharePoint Designer, you can create a SharePoint list from it as well as Forms to create, list, update and delete data in SharePoint by clicking on “Create List & Forms”. Here’s how to do it:

Note: you can also do it from SharePoint, but don’t forget to create the InfoPath forms or else you’ll only be able to list and delete data as you won’t have any forms to create and update it.



Set Permissions so users can use the BCS

At this point, everything is ready however if you try to access your list you’ll get this error:

Access denied by Business Data Connectivity

That’s actually normal: by default no user (even the one who created it) can access external data, you need to grant this permission explicitly.

To do this, go to: Central Administration -> Application Management -> Manage Service Applications ->Business Data Connectivity Service* -> [Your Entity] -> Set Permissions, and grant them to the desired accounts or groups. (Here’s a nice blog post with screenshots illustrating how to do it: Access denied by Business Data Connectivity solution).



And taadaa!! Here’s your data in SharePoint:

image image

Furthermore, now that your data is in SharePoint you can do way more that just listing them or editing them, you can for instance:



Carl Anderson

2011 in review

January 23, 2012 Leave a comment

The stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 16,000 times in 2011. If it were a concert at Sydney Opera House, it would take about 6 sold-out performances for that many people to see it.

Click here to see the complete report.

Categories: News

January 23rd 2012 Links: Software Development, Azure, WPF, ASP.NET, Tips

January 23, 2012 2 comments

Here’s our second post in our link-listing series:

Software Development

How I learned to stop worrying and write my own ORM

This post was written by one of the Stack Overflow guys (pretty good resume isn’t it?). It illustrates certain issues due to a core principle of ORMs: “the 100% dynamic” also known as “I hate databases, can’t I do everything in C#?”.


HTML5 and the Rise of Hybrid Apps

More and more apps are built in cross-platform HTML5 which is then wrapped into a native container.


Windows Azure

Scott Guthrie’s latest public presentation

New to Windows Azure, or looking for an update on where the platform is at? Check this one out, it’s the best place to start!



Announcing the Bing Maps WPF Control v1

Yay, maps in our WPF apps!



Truly Understanding ViewState

An old, yet very helpful, article on the ASP.NET ViewState.


Coding Tips

How can I detect the language a run of text is written in?

Ever needed to figure in what language a unicode string is? Here’s a great post providing valuable information on the topic.


Want Source Server to Work with Managed Minidumps in Visual Studio? Here’s How!

I guess the title says it all Smile


PerfView: New CLR and .NET Performance tool

Vance Morrison, CLR performance architect at Microsoft, has released a new tool (free) for conducting performance investigations on .NET applications.


Hope this helps,

Carl Anderson

CodeFluent Entities: Generating a CHM documentation from your Business Object Model

January 19, 2012 2 comments

CodeFluent Entities provides a Documentation producer capable of generating all files and scripts required by Sandcastle to generate a Microsoft Compiled HTML Help (CHM) documentation out of your CodeFluent Entities generated .NET Business Object Model (BOM).

Step 1: Downloading Sandcastle

First, you need to download and install Sandcastle on your machine (


Step 2: Generate using CodeFluent Entities

Then in your model, add the Documentation sub-producer to your Business Object Model Producer:


As the Sandcastle Target Directory, set the directory in which you want the sub-producer to generate all the Sandcastle scripts.

If you generate over again, you’ll notice that all members of your BOM (classes, fields, properties, methods) now have remarks:

/// <summary>
///     Loads this instance.
/// </summary><param name=”id”>The id.</param>
public static SoftFluent.Advertising.Customer Load(int id)


Step 3: Get the XML documentation file & assembly

To build the CHM documentation Sandcastle needs as an input:

  • The XML documentation file,
  • The actual .NET assembly.

The XML documentation file isn’t created by default, to do so, in your project properties, in the Build tab, you need to check it:


Build your project so you’ll get both the XML documentation file made out of the generated remarks, as well as the compiled assembly (.dll).


Step 4: Check everything is in order

Those files, the XML documentation and dll, are passed to Sandcastle production tools by the BuildDocumentation.cmd script.

So, before running the script, make sure the paths used in it are correct!

Secondly, the MrefBuilder.exe tool uses reflection to extract information, therefore you need to specify all dependencies used by your BOM so it can load your assembly.

Once the MrefBuilder line of the script runs fine, you’re ready to run the script!


Step 5: Generate your documentation!

Run the script, and as a result you’ll have a Microsoft Compiled HTML Help documentation in the Chm directory:



Carl Anderson

New CodeFluent Entities Release Available

January 17, 2012 3 comments

A new version of CodeFluent Entities is publicly available (1.0.60110.644) which contains a set of new features which we’ll overview in this post.


Feature #1: The Resource Grid

This new release provides a new culture-oriented grid form which allows batch resources edition (project-wide or node-specific).



Feature #2: The Instance Grid

Same as the the resource grid but for instances:


We can now edit multiple instances at once Smile


Feature #3: “Go To Xml”

Doing a right-click on a concept on the surface (entities, properties, views, methods, forms, etc.) you now have a “Go To Xml” option in the contextual menu which will take you to the XML node corresponding to the selected shape.



Feature #4: Support for non-latin characters

I’m sure all non-latin users will be glad to know that using the latest build, you can design your application using non latin-characters:



Feature #5: Minimize the Ribbon

Probably the sexiest feature in this release: you can now hide/show the ribbon using the upper-right corner arrow:




Interested in getting more details on what is shipped with each release? Subscribe to the CodeFluent Entities RSS Feed and you’ll automatically get all bug fixes and new features comprised in each build as soon as they are online!


Carl Anderson

CodeFluent Entities: Member Format Expressions (Final Part)

January 13, 2012 Leave a comment

Last post exploring this feature of the Modeler, detailing what you can do in conditions and the MessagesBrowser class.


In the previous post, we’ve seen that we could specify a condition attribute in the <if> and <font> tags. A few notes on the condition attribute:

  • Property paths in condition attributes should not be surrounded by curly brackets (i.e. use IsKey instead of {IsKey}),
  • Shortcuts available on the right side of the statement to ease condition declaration,
  • Therefore prefer placing evaluated values on the left side of the statement rather than on the right.

The following operators are supported:

  • “==” or “=” for a case insensitive equals,
  • “[=CS]” for a case sensitive equals,
  • “!=”, “<>” for a case insensitive not equals,
  • “[!=CS]” for a case sensitive not equals,
  • “>=” for greater than equals,
  • “<=” for lower than equals,
  • “>” for greater than,
  • “<” for lower than,
  • “[StartsWith]” for a case insensitve starts with,
  • “[StartsWithCS]” for a case sensitive starts with,
  • “[EndsWith]” for a case insensitive ends with,
  • “[EndsWithCS]” for a case sensitive ends with,
  • “[Contains]” for a case insensitive contains,
  • “[ContainsCS]” for a case sensitive contains.

Here’s how to highlight all properties ending with “Id”:

<font condition=”Name [EndsWith] ‘Id'” color=’red’>{#Name}<else/>{#Name}</font>

Note: don’t forget to surround the right side statement with quotes so the evaluator knows it’s a string.

Please note that there are also shortcuts such as you don’t have to specify ‘> 0’ for numbers for instance:

{#Name}<font condition=’AllRules.Count’ color=’#007F0E’> (Rules={AllRules.Count})</font>

Will suffix properties with “(Rules=X)” in green:



The MessagesBrowser Class

The MessagesBrowser class is a class you can use as a property path and which allows you to access messages (a.k.a. resources) defined for the current concept (entity or property). For instance, if you defined English resources for each of your address properties in the documentation class:


Using the following expression you can display them:

{#Name} ({MessagesBrowser._doc.en-US})

Here’s the result:


Note: As of today, for performance results the MessagesBrowser class is cached and built on first access, so that defining a new resource or editing one will not be reflected on the surface.

Carl Anderson

CodeFluent Entities: Member Format Expressions (Part 2)

January 13, 2012 1 comment

In the previous post, we’ve seen that we could define expressions such as “{Name}” to display the property name, “{#Name}” to display the decamelized property name, and mix values and literals in expressions to do stuff such as “{#Name} (IsKey={IsKey})”.

In this post we’re going to go a little further by introducing “tags”. Three tags are supported in expressions:

  • Font: use it to define styles in your expression,
  • If: use it to define conditions,
  • Else: same as if.

For instance specify the following expression:

<font color=”blue”>{#Name}</font>

Will display all properties in blue:


We could also combine the tags to display key properties in red and the other ones in blue:

<if condition=IsKey><font color=”red”>{#Name}</font><else/><font color=”blue”>{#Name}</font></if>

Note: the value in the condition attribute is automatically evaluated, no need to wrap the property path between curly brackets.

And here’s the result:


So expressions don’t get too long the <font> tag also has a condition attribute so you don’t necessarily have to wrap it in a <if> tag. Therefore, you could get the same result using this expression:

<font condition=IsKey color=”red”>{#Name}<else/><font color=”blue”>{#Name}</font></font>

The <font> tag supports the following attributes:

Here’s another expression displaying the property type name in a light purple (Alpha=DD, Red=6E, Green=14, Blue=FF):

{#Name} : <font color=”#DD6E14FF”>{#DisplayTypeName}</font>

And here’s the result:


Once again use member format expressions with caution as they’ll be evaluated for all property names, so the lighter they are, the better performances will be and vice versa.

Carl Anderson