Archive
User Interfaces generated by CodeFluent Entities using out-of-the-box producers
Over the past articles we showed you how to use the following UI producers provided out of the box by CodeFluent Entities:
· ASP.NET Web Forms Producer / AJAX/JSON
· SharePoint Web Part Producer
In this article I want to emphasize the fact that CodeFluent Entities is totally UI-agnostic. Indeed from the same and unique model you can generate screens that will be rendered in the targeted platforms of your choice. Here is for instance the list of all UI producers available:
Let see all the user interfaces that CodeFluent Entities has been able to generate from the exact same model, using those different producers.
Note that the generated applications are not just a set of user interfaces; they are actually complete interactive applications sharing the same business object model, database and are 100% functional.
We used the “ContactManager Sample Model” supply by CodeFluent Entities:
Here is the ContactManager model:
Since we’ve already seen how to use the producers provided by CodeFluent Entities in previous blog posts I’m going to skip their configurations and directly present you the generated UIs:
UI generated using the Windows 8 Store Producer:
The homepage generated by default lists all namespaces and their contained entities:
Clicking on an entity gets you to the entity page.
On this entity page you’ll find a screenshot of the entity from which this page was generated.
Right Clicking on this page or typing Ctrl+Z will bring up a menu at the bottom where you’ll find the list of actions available on this entity. Those actions correspond in fact to business methods provided by the entity:
Here is the screen displaying for the Contact entity when clicking on the “LoadAll” button and then selecting a contact:
Bringing back the menu by hitting Ctrl+z or right clicking will enable you to create, edit or delete an entry:
For instance, pushing the Edit button will give you the following screen:
UI generated using the ASP .NET MVC Producer:
The homepage generated by default lists all namespaces and their contained entities:
Clicking on an entity gets you to the entity page.
On this entity page you’ll find a screenshot of the entity from which this page was generated.
On the left side of the page you’ll find a list of actions available on this entity. Those actions correspond to business methods provided by the entity:
Here is the screen displaying for the Contact entity when clicking on the “LoadAll” button:
It lists all the contacts through an HTML table and enables sorting.
From it you can detail, edit or remove a contact.
Clicking on the “Details” hyperlink will bring up the following screen:
Clicking on the “Edit” hyperlink will enable you to edit the entry:
UI generated using the ASP .NET AJAX Producer:
The homepage generated by default lists all namespaces and their contained entities:
Clicking on an entity gets you to the entity page.
On this entity page you’ll find a screenshot of the entity from which this page was generated.
On the left side of the page you’ll find a list of actions available on this entity. Those actions correspond to business methods provided by the entity:
Here is the screen displaying for the Contact entity when clicking on the “LoadAll” button:
It lists all the contacts through an Ajax grid supporting sorting and paging.
From it you can detail, edit or remove a contact.
And the one when clicking on the “Edit” button:
UI generated using the ASP .NET WebForms Producer:
The homepage generated by default lists all namespaces and their contained entities:
Clicking on an entity gets you to the entity page.
On this entity page you’ll find a screenshot of the entity from which this page was generated.
On the left side of the page you’ll find a list of actions available on this entity. Those actions correspond to business methods provided by the entity:
Here is the screen displaying for the Contact entity when clicking on the “LoadAll” button:
It lists all the contacts through an HTML table and enables sorting.
From it you can edit or remove a contact.
And the one when clicking on the “Edit” button:
UI generated using the Smart Client (WPF) Producer:
The first screen generated by default lists all namespaces and their contained entities:
Clicking on an entity will load all the data corresponding to it:
From it you can create, edit or remove an entry.
Clicking on an entry will open a window to edit it:
UI generated using the SharePoint WebParts Producer:
The homepage generated by default lists all namespaces:
Clicking on a namespace lists all its entities:
Clicking on an entity gets you to the entity page:
It lists all the data of that entity through a Web Part.
From it you can create a new entry, detail, edit or delete one.
![]()
For instance, clicking on an entry brings up its details:
and clicking on the “Edit” button brings up the editor:
As you can see, from a same model we have generated several UIs all consistent with each other.
Besides, thanks to the Platform Independent Form Editor you can also define forms directly on their entities which will then be translated into actual screens by user interface producers. We talked about it in details in this article.
Finally, in the case you did not find the desired producer, I remind you that you can create your own template and use it with the Template Producer or you can even create your own custom producer. All you’ll need to do would be to implement the IProducer interface.
To sum up, CodeFluent Entities is able to generate 100% functional applications with the UI of your choice just by using the right producer.
Cheers,
Thibault Nestor
CodeFluent Entities: SharePoint Web Part Producer
In previous posts, we’ve introduced the SharePoint Web Part Producer, shown its output, and that you could customize forms. In this post we’ll show you how to generate web parts ![]()
To generate web parts, add the SharePoint Web Part Producer to your project by clicking “Add new producer” on the “Producers” folder in Visual Studio’s Solution Explorer, expand the Web Producers node and select it:
The SharePoint Web Part producer provides two main types of features:
- code generation features,
- deployment features.
You can use it to generate code, compile it and deploy it on a SharePoint server in the same run, however here since we want to be able to view and extend the code, compile with Visual Studio and deploy ourselves, we’re going to disable those deployment features.
Here’s a sample configuration:
Properties I changed are in bold:
- Source Production > Target Directory (mandatory): I’m making it point to my class library project containing my generated .NET classes
- Deployment > Copy Binaries: Set it to false, we’ll compile with VS so the producer has no binary to deploy yet,
- Deployment > Update [trust].config: Set it to false, same as before, for now we’re developing, we’re not bothering with deployment stuff,
- Deployment > Update web.config: Set it to false, same as [trust].config,
- Site Creator > Produce MsBuild Task Files: The site creator feature is to create a document library on the SharePoint server to test our generated web parts, set it to false for now,
- Site Creator > Produce Source Files: set it to false as well.
Build your project over and….ooops! We get the following error:
CF5519: The SharePoint WebParts producer needs the ‘SoftFluent.AssociationManage’ pattern to be included in the project.
Correct, the AssociationManage Aspect is needed by the SharePoint producer as it adds many-to-many management features which are required in the generated UI.
While we’re at it, I’d also recommend you add the AutoFormattable aspect to your project as in the generated UI, for one to many relations, you’ll get a preview of related data if any instead of just the number of related items.
Generate over, and there you go: you’ll see that custom web parts were generated:
Carl Anderson
CodeFluent Entities: Using your application in SharePoint 2010
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: http://msdn.microsoft.com/en-us/library/ee558778.aspx.
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).
Result
And taadaa!! Here’s your data in SharePoint:
Furthermore, now that your data is in SharePoint you can do way more that just listing them or editing them, you can for instance:
- connect your list to Outlook,
- connect your list to SharePoint Workspace,
- show external data in Word,
- and more (search on your external data, define filters for item pickers etc.)!
Cheers,
Carl Anderson
Generate Web Parts Using CodeFluent Entities (Video)
We introduced in previous posts that CodeFluent Entities provides a SharePoint Web Part Producer which lets you generate SharePoint web parts from your model:
Since you’re familiar with the theory, check-out this video to see how the generated web parts looks like by default:
Note: CodeFluent Entities supports WSS 3.0, MOSS 2007, SharePoint Foundation 2010, and SharePoint 2010
CodeFluent Entities Webinar – June 15th 2011
In this webinar Carl Anderson demonstrates CodeFluent Entities using the latest release of the product. This includes designing an application from scratch, generating a database and .NET code, using the generated code, generating entire applications including UI (SharePoint and WPF Smart-Client), as well as importing an existing Microsoft Access database.
If you’re interested but could not attend to the webinar, you’ll be glad to know that it was recorded and is now available online:
http://www.youtube.com/watch?v=3r_pEmRLBuY
Note: Watch the video in HD by selecting the 720p option instead of the default 360p on the bottom right section of the player.
Introduction to SharePoint Lists
Starting with Office 2003, Microsoft introduced SharePoint Lists which allow Office client application such as Excel to manipulate lists of data provided by SharePoint. This way users can keep information in their Excel/Access tables synchronized with a list hosted on the SharePoint site. This feature is available for Excel 2003+ and Access 2007+.
CodeFluent Entities can generate Web Services – which can be hosted in IIS or WCF – which emulate a SharePoint server so that Excel and/or Access can be used to edit your data. Since it leverages a Microsoft Office built-in feature, it does not require any deployment on user’s machines. The global architecture is illustrated in the following figure:
As shown in the figure above, using the generated lists does not require SharePoint at all, it only emulates SharePoint as Office applications such as Excel and Access were built to consume Lists hosted in SharePoint. From a developer’s perspective, all server components from the data tier to the web services can be generated by CodeFluent Entities. By default each entity has a list per load method (e.g. LoadAll). Moreover, you can design extra lists by adding views on your entity. By the way, the generated classes are public partial classes, so if you need to create some very specific list, you can always write it yourself without having your code overwritten on a following generation.
Finally, since your generated lists use the business objet model to manipulate data, your business logic is still applied.
In a nutshell, generating Office synchronizable lists for Excel and Access enables end-users to edit and manipulate massive amounts of data in a familiar UI. End-users will benefit from advanced features such as Excel’s filters, sorting and pivot tables or Access’ Form View. Furthermore, it’s all based on a built-in feature which does not require to deploy any component on the client side, nor to actually have SharePoint on the server.