Thursday, March 31, 2011

FluentPS v2.0 release

Hi everybody,

We are happy to announce that FluentPS v2.0 release came out! Release notes can be found at Codeplex project page. The essentials of FluentPS usage remain the same, please refer to the previous posts here and here for more info. Any feedback is welcome.

This release got a huge set of bug fixes and enhancements. The FluentPS library has been split to a set of libraries: FluentPS itself, FluentSP and FluentPS.Migrations.Core. According to this, FluentPS remains to be Project Server-oriented, FluentSP got all SharePoint-related services and FluentPS.Migrations.Core is used to create migrations. All main changes are covered below.

FluentPS PSProjectService and entity mapping

The PSProjectService got a lot of new methods so now you can perform GET/UPDATE operations more efficiently. For instance, you can specify which properties you'd like to read. UPDATE operation can be made very fast by specifying WHICH properties are affected and HOW these properties are affected by providing collections of property expressions and actions respectively. This feature can become extremely useful in bulk update operations and workflow development.

Previously you had to know all the properties you were going to work with and to map those with FluentPS attributes. Check out our new DynamicEntity feature which is helpful when you need to operate with properties that did not even exist in compile-time.

We also extended present mapping attributes with new properties and added a couple of new attributes. It is now possible to map required fields, fields of type Formula, etc:

[PSEntityType(PSEntityType.Project)]
public class MyProject
{
    ...

    [PSFormulaField("{455D3C0F-97B7-41D9-936A-755A8D3B63EB}",
        "IIf([{c2ac10bf-14af-41a4-99bb-f64c3e669c65}] = 1, 'My Value')",
        FieldName = "Formula Field",
        Description = "Formula Field description",
        FieldType = PSFieldType.Text)]
    public string FormulaField { get; set; }

    [PSLookupField("{7AD04D02-2838-45E0-B879-C3D569B51550}", 
        LookupTableUid = "{93b13ac0-08db-4075-8330-22fa845a9408}",
        LookupTableName = "Lookup Table Name",
        GraphicalIndicator = "[[== Green  ][1]][[== Yellow  ][2]][[== Red  ][3]]",
        FieldName = "Lookup Table Field", 
        Description = "Lookup Table Field description",
        IsRequired = true,
        DefaultValue = "Green")]
    public string LookupTableField { get; set; }
}

FluentSP services overview

If you need to work with SharePoint services only you would use FluentSP library which is separated out of FluentPS. One of its differentiators from alternative libraries (i.e., LINQ to SharePoint) is support of calls to external SharePoint services from web context. Almost all services have been enhanced with new methods which contain lacking functionality. Also we created a couple of brand new services to cover a few other areas such as SharePoint lists, libraries and pages, etc. You can now work with SharePoint lists in the same manner as you do with Project Server entities:

[SPList("My List", "0x0100663707ba995d4796b3210c7de3f2711b")]
public class MyListItem
{
    [SPListItemProperty(FluentSP.Consts.SPListItemPropertyNames.ID)]
    public int Id { get; set; }
  
    [SPField("Title")]
    public string Title { get; set; }
  
    [SPField("TextProperty")]
    public string TextProperty { get; set; }

    [SPField("MyUser")]
    public FluentSP.Model.SPUser MyUser { get; set; }
}

FluentPS.Migrations.Core library

All the functionality regarding migrations has been moved to a separate library, FluentPS.Migrations.Core, which provides few abstractions for creating migrations. A migration can be considered as a unit of work, therefore deployment of a large solution can be more controllable if you have a set of migrations. The starting point in creating migrations is implementing GetService method of BaseMigration class which should provide instances of migrations with services for further calls. We are considering shipping a client application that is capable of reading and running migrations from assemblies.

Read more...