This project is read-only.
Project Description
The SharePoint Genesis Framework for SharePoint 2010 gives you a new way to declare fields, content types, list instances and feature definitions in code. It also gives you a more flexible solution for handling entities than SPMetal and Linq-2-SharePoint.

SPGenesis is now also available at NuGet.


This project was created to simplify some common application patterns and design when creating SharePoint solutions. It started out as an experimental platform for designing more robust and maintainable SharePoint solutions. It targets some common complexities when delving with SharePoint development like accessing and referencing artifacts like fields, lists, content types, features etc. The framework provides you with the most common and frequently used operations against the SharePoint API to help you write more readeble and maintainable code. For me it helped out a lot so I could focus more on the application and business logic than having to put most of the development time on understanding low level Sharepoint API functions and classes. The declarative model of the Genesis Framework helps you designing or reference elements (fields, lists etc.) that are deployed either by XML-definitions or by code. It helps separate them from your application and business logic and offers an easy way of referencing their definitions. You can read more about all the details in the documentation section on this site.

This project is still under development and it will be updated continuously. Feel free to comment this project. All feedback is appreciated!

Have fun!

When to use

- When you need to have more flexible control over provisioning scenarios for fields, content types and list instances.
- Single point of access to elements and their definitions (instead of field id constants etc. all over the place.)
- Type safe field values from list items.
- Easy to use, easy to understand declarative syntax.
- More flexible domain model solutions than SPMetal and Linq 2 Sharepoint.

How to use

- Download the framework binaries which are provided by this site.
- For elements like fields, content types, list instances and features see the documentation and how-to section.



To declare a site field (site column), create a class which inherits SPGENField from the Genesis framework. Provide a field ID which will be used to bind this class with the fields that will be created in SharePoint later on. Here is an example of the syntax.

        ID = "{EC23CA6E-BA90-443F-9F3A-6D54889298F4}", 
        DisplayName = "My field 1", 
        Type = SPFieldType.Text, 
        Group = "SPGenesis demo")]
    public class MyField1 : SPGENField<MyField1, SPFieldText, string>

As you can see, this shows an example of how the declarative model looks like.

Now when you need to acces the field definition use follwing syntax (console application):

    Console.WriteLine("MyField1 ID is:" , MyField1.ID);
    Console.WriteLine("MyField1 Internal name is:" , MyField1.InternalName);
    Console.WriteLine("MyField1 field type is:" , MyField1.Definition.Type.ToString());

Here are some examples of how to provision, that means create or update the field:


    MyField1.Instance.Provision(spWeb); //spWeb is a reference to a SPWeb instance.   

    MyField1.Instance.Provision(spList); //spList is a reference to a SPList instance.   

To unprovision, that means remove the field, use:


    MyField1.Instance.Unprovision(spWeb); //spWeb is a reference to a SPWeb object.   

    MyField1.Instance.Unprovision(spList); //spList is a reference to a SPList object.   

Here is an example of how to get the item value for this field from a SPListItem object. It uses the information provided in the field declaration (see further up on this page) on how to cast this field value to. In this case it is a string because the field type is SPFieldText. Instead of casting the item value on every access it will be taken care of inside the framework. It uses the type provided in the field declaration.

    string fieldValue = MyField1.Instance.GetItemValue(spListItem); // spListItem is a reference to a SPListItem object.

More information what you can do and how to use can be found in the documentation section. There are also som project examples that can be downloaded on this site.

Why the name "Genesis"? The name "Genesis" means birth, creation or beginning in old greek. it was chosen because of the way this framework should be used, namely to construct and design the roots or foundation of you sharepoint solutions.

Blog posts about this project:

Please visit my dear friend and colleague Johan Leino's project site on Code plex

Feel free to visit my other project here at codeplex SPVisualDev

Tony Restaino
Consultant at Avega Group, Sweden

Last edited Jan 12, 2012 at 5:40 PM by tore7506, version 33