Using the Sense/Net Portal File System in non web environments

Portal File System can be used both in ASP.NET and in nonweb environments such as Winforms and console applications, Windows services, etc. This is usefull for the following development scenarios

  • First time users: experiment and play with the PFS in a console application to get immediate results
  • Use PFS as a general purpose content repository regardless of application type
  • Create data storage agnostic, business entity oriented applications


To use PFS in a console application you need to do these steps:

1) Create a reference to SenseNet.PortalEngine.dll and SenseNet.PortalFileSystem.dll

2)  Set some application config settings in *.config
 You'll need these:
<add key="DataProvider" value="SenseNet.PortalEngine.PortalFileSystem.Data.SqlClient.SqlProvider" />
<add key="AccessProvider" value="SenseNet.PortalEngine.DesktopAccessProvider, PortalEngine" />
<add key="DefaultLockTimeout" value="600" />
<add key="PfsCache" value="true" />
<add name="PfsMsSql" connectionString="Persist Security Info=False;Initial Catalog=SNTNG;Data Source=.\sqlexpress;Integrated Security=True" />
3) Enjoy PFS
namespace ConsoleClient
    class Program
        static void Main(string[] args)
            //Folder rootNode = Node.Load("/Root") as Folder;
            Folder rootNode = Node.Load<Folder>("/Root");
            foreach (Node childNode in rootNode.Children)
And the output in my case (you might get different results)

Comments are closed

Welcome to the blog!

Sense/Net ECM is ever evolving. Community means the world to us so we want to keep you apprised on what’s happening on our side of the woods. Want to make us happy? Add a comment and tell us what you think!

Month List