<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brightstar Blog</title>
	<atom:link href="http://brightstardb.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://brightstardb.com/blog</link>
	<description>Articles and news from the Brightstar Team</description>
	<lastBuildDate>Wed, 15 Feb 2012 12:26:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>BrightstarDB Public Beta Released</title>
		<link>http://brightstardb.com/blog/?p=223</link>
		<comments>http://brightstardb.com/blog/?p=223#comments</comments>
		<pubDate>Tue, 07 Feb 2012 13:25:49 +0000</pubDate>
		<dc:creator>Kal</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://brightstardb.com/blog/?p=223</guid>
		<description><![CDATA[After a few months of a successful closed beta period, we are now pleased to announce the release of the first public beta of BrightstarDB. If you are new to this site you might want to take a read of Why BrightstarDB to understand what makes BrightstarDB special, but in short BrightstarDB is a native...<br/><a href="http://brightstardb.com/blog/?p=223">Read the full post</a>]]></description>
			<content:encoded><![CDATA[<p>After a few months of a successful closed beta period, we are now pleased to announce the release of the first public beta of BrightstarDB. If you are new to this site you might want to take a read of <a href="http://brightstardb.com/documentation/Why_BrightstarDB_.html">Why BrightstarDB</a> to understand what makes BrightstarDB special, but in short BrightstarDB is a native .NET triple-store that provides all the features of NoSQL data-stores, plus a fully functional .NET entity framework complete with support for LINQ queries. With BrightstarDB you can also easily publish your data as RDF Linked Data with a SPARQL endpoint and now also as OData. BrightstarDB scales up to enterprise-scale data and down to run on a mobile phone.</p>
<p>For those of you who are upgrading from the closed beta, the <a href="http://brightstardb.com/documentation/Whats_New.html">Whats New</a> section of the documentation describes the new features.</p>
<p>BrightstarDB is available to download now. If you do download please consider adding this <a href="http://brightstardb.com/blog/?feed=rss2" title="BrighstarDB Blog RSS Feed">blog&#8217;s feed</a> to your RSS feed reader and/or joining our <a href="https://groups.google.com/a/networkedplanet.com/group/brightstardb-user-group" title="BrightstarDB Users Group">Google Group</a> where you can post questions and get answers directly from the developers.</p>
]]></content:encoded>
			<wfw:commentRss>http://brightstardb.com/blog/?feed=rss2&#038;p=223</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blog rolling with BrightstarDB, Express and Node.js</title>
		<link>http://brightstardb.com/blog/?p=116</link>
		<comments>http://brightstardb.com/blog/?p=116#comments</comments>
		<pubDate>Thu, 26 Jan 2012 14:52:02 +0000</pubDate>
		<dc:creator>Andrew Turley</dc:creator>
				<category><![CDATA[Developer Tips]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Node.js]]></category>

		<guid isPermaLink="false">http://brightstardb.com/blog/?p=116</guid>
		<description><![CDATA[Inspired by the use of Node.js and mongoDB in this How To Node article, this tutorial aims to show how BrightstarDB can also be used with Node to create a simple blogging system. Before starting, ensure you have the following installed; BrightstarDB Node.js ASP.NET MVC Node needs to be able to access data from BrightstarDB,...<br/><a href="http://brightstardb.com/blog/?p=116">Read the full post</a>]]></description>
			<content:encoded><![CDATA[<p>Inspired by the use of Node.js and mongoDB in this <a title="Blog rolling with mongoDB, express and Node.js" href="http://howtonode.org/express-mongodb">How To Node article</a>, this tutorial aims to show how BrightstarDB can also be used with Node to create a simple blogging system.</p>
<p><span id="more-116"></span></p>
<p>Before starting, ensure you have the following installed;</p>
<ol>
<li>BrightstarDB</li>
<li>Node.js</li>
<li>ASP.NET MVC</li>
</ol>
<p>Node needs to be able to access data from BrightstarDB, unfortunately we can&#8217;t use WCF under Node, so first of all we will create a simple ASP.NET MVC Rest service which will handle querying and interactions with BrightstarDB.</p>
<p><em>If you just want to get straight to the code, a download for the source of both projects is available at the end of the post.</em></p>
<h2>Creating MVC Rest interface for BrightstarDB</h2>
<p>For the blogging system, our Rest interface will allow the following commands;</p>
<ul>
<li>Query a store by name using sparql and returning the results as <a title="JTriples" href="http://www.w3.org/wiki/JTriples">JTriples</a></li>
<li>Post a new article using <a title="N-Triples" href="http://www.w3.org/2001/sw/RDFCore/ntriples/">N-Triples</a></li>
</ul>
<p>To get started, first create a new <strong>ASP.NET MVC 3 Project</strong>. For the Template, choose <strong>Empty.</strong></p>
<p>In the project <strong>References</strong> add a reference to the <strong>NetworkedPlanet.Brightstar.dll.</strong></p>
<p>Add a new <strong>Controller</strong> to the project and name it <em>StoreController.cs. </em> This will serve as the main interface to the BrightstarDB store. We will be using the <strong>BrightstarService</strong> class to create an embedded client, so we need to include the following using statement in the top of our controller;</p>
<p><script src="https://gist.github.com/1641064.js?file=StoreController.cs"></script></p>
<p>Before using the embedded client we need a location for our BrightstarDB data. Open the BrightstarDB management application <strong>Polaris</strong> and create a new Embedded connection to a location on your computer.</p>
<div id="attachment_127" class="wp-caption alignnone" style="width: 411px"><a href="http://brightstardb.com/blog/wp-content/uploads/2012/01/BrightstarDBEmbeddedConnection.png" rel="lightbox[116]"><img class="size-full wp-image-127" title="BrightstarDB Embedded Connection" src="http://brightstardb.com/blog/wp-content/uploads/2012/01/BrightstarDBEmbeddedConnection.png" alt="BrightstarDB Embedded Connection" width="401" height="322" /></a><p class="wp-caption-text">Creating a BrightstarDB Embedded Connection in Polaris</p></div>
<p>From the <strong>Server</strong> menu, choose <strong>New Store&#8230;</strong> and call it <em>&#8216;Blog&#8217;</em>.</p>
<div id="attachment_128" class="wp-caption alignnone" style="width: 533px"><a href="http://brightstardb.com/blog/wp-content/uploads/2012/01/BrightstarDBCreateStore.png" rel="lightbox[116]"><img class="size-full wp-image-128" title="BrightstarDB Create Store" src="http://brightstardb.com/blog/wp-content/uploads/2012/01/BrightstarDBCreateStore.png" alt="BrightstarDB Create Store" width="523" height="398" /></a><p class="wp-caption-text">Create a new store called &#39;Blog&#39;</p></div>
<p>This will create a new store in our BrightstarDB data folder named &#8216;Blog&#8217;. Back to our MVC project and StoreController.cs, we can now create an embedded client and point it to the path we used in Polaris to create the &#8216;Blog&#8217; store.</p>
<p>In <strong>StoreController.cs</strong> add the following property, be sure to use the location of the BrightstarDB data folder and not the location of the &#8216;Blog&#8217; store folder;</p>
<p><script src="https://gist.github.com/1641081.js?file=StoreController.cs"></script></p>
<p>This will create a BrightstarService property called Context which will be using to perform queries and transactions on our &#8216;Blog&#8217; store.</p>
<p>Next, we first need to be able to query our store, the path to this Rest method will look like this;</p>
<pre>/store/{storename}?query=&lt;sparql query&gt;</pre>
<p>Add the following method that accepts a storeName and a query variable;</p>
<p><script src="https://gist.github.com/1641091.js?file=StoreController.cs"></script></p>
<p>The above method uses the BrightstarService Context to execute a Sparql query against our named store. The results are iterated by row and the names of the columns and its value added to a Dictionary for each row. A List&lt;Dictionary&lt;string,string&gt;&gt; allows us to return the results using the JsonResult class from ASP.NET in the <a title="JTriples" href="http://www.w3.org/wiki/JTriples">JTriples</a> format.</p>
<p><em>Note, the above method uses a Sparql extension method, <strong>GetVariableNames</strong>, if the method is not available in the release you are using, then add the following code to StoreController.cs and change the above code to use the private mehtod GetVariableNames below.</em></p>
<p><script src="https://gist.github.com/1662829.js?file=StoreController.cs"></script></p>
<p>To support adding new blog posts, we need to add an <strong>Insert</strong> method. Our insert method will use the Rest path;</p>
<pre>/store/{storename}/insert?triples=&lt;triples&gt;</pre>
<p>In <strong>StoreController.cs</strong> add the following method;</p>
<p><script src="https://gist.github.com/1641096.js?file=StoreController.cs"></script></p>
<p>The above method accepts <a title="NTriples" href="http://www.w3.org/2001/sw/RDFCore/ntriples/">NTriple</a> data and uses the BrightstarService Context to insert the data into the named store. Because we want to return when the job is finished, we wait until the job status is OK before returning. Of course we are assuming that the NTriples are valid and the job will never fail, this may not always be the case so you would need to check for this.</p>
<p>Lastly, to finish the MVC project we need to add additional routes in <strong>Global.asax.cs</strong>.</p>
<p>Update the <strong>RegisterRoutes</strong> method with the following;</p>
<p><script src="https://gist.github.com/1641104.js?file=Global.asax.cs"></script></p>
<p>This will map our methods in <strong>StoreController.cs</strong> to the routes specified earlier. Make sure to run the server by pressing <strong>F5</strong> and make a note of the <strong>port number</strong> that the server is using.</p>
<h2>Creating the Node blog application</h2>
<p>Before starting to write the Node application, first of all we should look at the triples that we will be storing in BrightstarDB for our blog articles.</p>
<p><script src="https://gist.github.com/1662476.js?file=gistfile1.txt"></script></p>
<p>In the above triple we are defining a &#8216;type&#8217; named &#8216;post&#8217; that has a &#8216;title&#8217;, &#8216;body&#8217; and &#8216;date&#8217;. For the sake of simplicity we will exclude storing comments in this post. To get started with the Node application, as well as <a title="NodeJS" href="http://nodejs.org/">Node</a> installed, we need to install <a title="Express" href="http://expressjs.com">Express</a>. To do this, execute the following in a command prompt;</p>
<pre>npm install express -g</pre>
<p>Note: Installing Nodejs under Windows should add <strong>node</strong> and <strong>npm </strong>to the system path, if it doesn&#8217;t add the following to your Path system environment variables;</p>
<pre>C:\Users\*<em>username*</em>\AppData\Roaming\npm;C:\Program Files (x86)\nodejs\;</pre>
<p>With Express installed, we can now create an Express starter project. In a command prompt run the following;</p>
<pre>mkdir blog
cd blog
express -c stylus
npm install -d</pre>
<p>This will generate an Express application using the stylus css engine, and download any dependancies using npm. To test that the application generated successfully, run node against the main app.js;</p>
<pre>node app.js</pre>
<p>You should now be able to access <a href="http://localhost:3000/">localhost:3000</a> and see the default express content. We will be creating the following <strong>operations</strong> in our blog application, these are:</p>
<ol>
<li>Displaying all blog articles</li>
<li>Creating a blog article</li>
<li>Displaying an individual blog article</li>
</ol>
<p>To create the interface between our application and the BrightstarDB ASP.NET MVC  service created earlier, we will add an communication layer named <strong>brightstar-server.js</strong> to our app.</p>
<p>Create a new file under the /blog folder named &#8216;brightstar-server.js&#8217; and add the following;</p>
<p><script src="https://gist.github.com/1641121.js?file=brightstar-server.js"></script></p>
<p>The <strong>BrightstarServer</strong> class provides a single method collection, that will contact the BrightstarDB ASP.NET MVC server using an HTTP request, execute a Sparql query to return all blog posts and process the resulting JSON. The Sparql query is requesting the &#8216;_id&#8217;, &#8216;title&#8217;, &#8216;body&#8217;, and &#8216;created_at&#8217; properties for each blog post. The JSON returned will look similar to the data below;</p>
<p><script src="https://gist.github.com/1641126.js?file=gistfile1.json"></script></p>
<p>Next we will create an articleprovider that uses the brightstarserver class. Add a new file named &#8216;<strong>articleprovider-brightstar.js&#8217;</strong> and include the following;</p>
<p><script src="https://gist.github.com/1641156.js?file=articleprovider-brightstar.js"></script></p>
<p>The <strong>ArticleProvider</strong> provides a single method <strong>findAll</strong> that uses the <strong>BrightstarServer</strong> class to fetch all of the blog posts. To make our blog app uses our ArticleProvider, we need to update <strong>app.js</strong> to render a view when the &#8216;/&#8217; route is called and display all of the blog posts.</p>
<p>Update <strong>app.js</strong> with the following ensuring that the port number for the ASP.NET server earlier is used when initialising ArticleProvider;</p>
<p><script src="https://gist.github.com/1641164.js?file=app.js"></script></p>
<p>Our application is now using the <strong>BrightstarDB ArticleProvider</strong>, calling its findAll method to fetch all of the blog posts and passing them to a view &#8216;index.jade&#8217;, which we will add now. Create a new file named <strong>index.jade</strong> and add the following code;</p>
<p><script src="https://gist.github.com/1641190.js?file=index.jade"></script></p>
<p>Update the file <strong>style.styl </strong>the following css rules;</p>
<p><script src="https://gist.github.com/1641197.js?file=style.styl"></script></p>
<p>Before we can test that the app is working correctly and fetching blog posts, we need to populate our store with some <strong>test data</strong>. Using <strong>Polaris</strong>, run a new transaction on the &#8216;Blog&#8217; store using the following test data;</p>
<p><script src="https://gist.github.com/1662595.js?file=gistfile1.txt"></script></p>
<div id="attachment_143" class="wp-caption alignnone" style="width: 697px"><a href="http://brightstardb.com/blog/wp-content/uploads/2012/01/BrightstarDBAddTriples.png" rel="lightbox[116]"><img class="size-full wp-image-143" title="BrightstarDB Add Triples using Polaris" src="http://brightstardb.com/blog/wp-content/uploads/2012/01/BrightstarDBAddTriples.png" alt="BrightstarDB Add Triples using Polaris" width="687" height="559" /></a><p class="wp-caption-text">Add Triples using Polaris</p></div>
<p>With the test data added, restart the Node server and run <strong>node app.js</strong>again. Refresh the site and there should now be three blog posts displayed on the page.</p>
<div id="attachment_146" class="wp-caption alignnone" style="width: 310px"><a href="http://brightstardb.com/blog/wp-content/uploads/2012/01/Blog.png" rel="lightbox[116]"><img class="size-medium wp-image-146" title="Blog test data" src="http://brightstardb.com/blog/wp-content/uploads/2012/01/Blog-300x262.png" alt="Blog test data" width="300" height="262" /></a><p class="wp-caption-text">Blog first page showing our test data</p></div>
<p>Now that we can display our posts we need to add functionality to <strong>create new articles</strong>. Create a new view named <strong>blog_new.jade</strong> and the following code;</p>
<p><script src="https://gist.github.com/1641201.js?file=blog_new.jade"></script></p>
<p>In <strong>app.js</strong> add another two routes to handle creating new blog posts;</p>
<p><script src="https://gist.github.com/1641210.js?file=app.js"></script></p>
<p>In <strong>brightstar-server.js</strong> and <strong>articleprovider-brightstar.js</strong> we need to add the the save methods to handle saving blog posts. Open <strong>brightstar-server.js</strong> and add the following method after the collection method;</p>
<p><script src="https://gist.github.com/1641214.js?file=brightstar-server.js"></script></p>
<p>The save method creates a set of NTriples from our post object and sends them to our ASP.NET MVC Rest server. Next we need to add the <strong>save</strong> method to our <strong>ArticleProvider</strong>.</p>
<p>In <strong>articleprovider-brightstar.js</strong> add another method for saving posts;</p>
<p><script src="https://gist.github.com/1641216.js?file=articleprovider-brightstar.js"></script></p>
<p>In the above method we first get all of the posts using the <strong>findAll</strong> method and use the number of existing posts to create an Id, then pass the article to BrightstarServer to save the post to the server. Reload the Node server and navigate to <a href="http://localhost:3000/blog/new">localhost:3000/blog/new</a> and check that posts can be saved. <em>Note, since characters are not escaped when saving the posts as triples, using carriage returns will cause an error!</em></p>
<p>Finally, we will add the ability to <strong>view a single post by Id</strong>. Open <strong>brightstar-server.js </strong>and add another method beneath the save method added previously;</p>
<p><script src="https://gist.github.com/1641234.js?file=brightstar-server.js"></script></p>
<p>In the method above we are using another Sparql query to return the &#8216;title&#8217;, &#8216;body, and &#8216;created_at&#8217; properties from the given Id. Since we are storing the ISO date, we need to create a Date() object using the date string for each row.</p>
<p>Next update <strong>articleprovider-brightstar.js</strong> with the following code to fetch a single post;</p>
<p><script src="https://gist.github.com/1641242.js?file=articleprovider-brightstar.js"></script></p>
<p>In the  code above we are simply calling the <strong>BrightstarServer</strong> method <strong>findById</strong>. Lastly, we need to add a new view to display a single article and add a route in <strong>app.js</strong>.</p>
<p>Create a new view and name it <strong>blog_show.jade</strong>, and add the following code;</p>
<p><script src="https://gist.github.com/1641249.js?file=blog_show.jade"></script></p>
<p>In <strong>app.js</strong> add another route for viewing individual posts;</p>
<p><script src="https://gist.github.com/1641258.js?file=app.js"></script></p>
<p>Restart the Node server and we should now be able to view all posts, open individual posts, and create new posts. It should also be possible to add comments to the blogging system so adding <strong>comments</strong> has been left as an exercise for the reader.</p>
<p>Hopefully this shows the possibilities that are available in using Node.js and BrightstarDB together.</p>
<p>Download the source for both projects.<br />
<a href="http://brightstardb.com/blog/wp-content/uploads/2012/01/BrightstarNodeJS-source.zip">BrightstarNodeJS-source</a></p>
<p><a href="http://www.codeproject.com" rel="tag" style="display:none">CodeProject</a></p>
]]></content:encoded>
			<wfw:commentRss>http://brightstardb.com/blog/?feed=rss2&#038;p=116</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developer Preview Update</title>
		<link>http://brightstardb.com/blog/?p=109</link>
		<comments>http://brightstardb.com/blog/?p=109#comments</comments>
		<pubDate>Fri, 09 Dec 2011 13:53:51 +0000</pubDate>
		<dc:creator>Kal</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[EntityFramework]]></category>
		<category><![CDATA[windowsphone]]></category>

		<guid isPermaLink="false">http://brightstardb.com/blog/?p=109</guid>
		<description><![CDATA[We are very happy to announce the release of a new version of the BrightstarDB Developer Preview. This post contains a brief overview of the new features in this release. As with the previous release, this Developer Preview is only available to those on our early-access list, so if this post whets your appetite, please signup for a download. ]]></description>
			<content:encoded><![CDATA[<p>We are very happy to announce the release of a new version of the BrightstarDB Developer Preview. As with the previous release, this Developer Preview is only available to those on our early-access list, so if this post whets your appetite, please <a href="http://brightstardb.com/download/">signup for a download</a>. If you already signed up, you should have received an email with a link to the update &#8211; if it didn&#8217;t arrive, please email support@networkedplanet.com and we&#8217;ll send you the link.</p>
<p>This release adds a number of new features which I&#8217;ll briefly list here. We will add more detailed content about some of these new features to the blog over the coming days.</p>
<p><strong>Windows Phone 7.1 Support</strong>. We now provide SDK libraries for building Windows Phone 7.1 applications that use BrightstarDB for storage. The data files are managed in the application&#8217;s Isolated Storage space and you can have multiple stores available to a single application if required.  Crucially, the store data files format is exactly the same as with the standard .NET 4.0 SDK. This means that you can create a store on your workstation and simply copy the files to your device and open them with the mobile version of the SDK! We have provided a few samples to get you going, including a sample of how to distribute a store as part of your application.</p>
<p><strong>Data Object API</strong>. By request, we have now publicly exposed and documented a mid-level API to BrightstarDB that sits between the low-level RDF API and the high-level Entity Framework. The Data Object API allows you to manage all the properties of a single RDF resource as a collection, making it easier to work with any shape of RDF data without having to map all the types to .NET interfaces.</p>
<p><strong>Optimistic Locking</strong>. The Data Object API and the Entity Framework now both support a simple form of optimistic locking that helps applications to ensure that they avoid concurrently modifying the same data.</p>
<p><strong>Data Export API</strong>. By request, we now provide an API for exporting the complete content of a BrightstarDB store as an NQuads file.</p>
<p><strong>Entity Framework API Improvements</strong>. The Entity Framework now supports creating inheritance hierarchies in your data model. Entity models now support properties that are collections of native types (e.g. ICollection&lt;string&gt;). We have added support to the LINQ implementation for the string comparison functions String.StartsWith and String.EndsWith and support for Regex.IsMatch for doing more complex regular expression pattern matching. We have also added some really cool support for polymorphism &#8211; any Entity Framework object can .Become() and instance of another Entity type by a single method call.</p>
<div>For a longer list of updates and changes, please take a read through <a title="What's New" href="http://brightstardb.com/documentation/Whats_New.html">What&#8217;s New</a> in our <a title="BrightstarDB Documentation" href="http://brightstardb.com/documentation/">updated documentation</a>.</div>
]]></content:encoded>
			<wfw:commentRss>http://brightstardb.com/blog/?feed=rss2&#038;p=109</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding a MembershipProvider to your MVC3 application</title>
		<link>http://brightstardb.com/blog/?p=45</link>
		<comments>http://brightstardb.com/blog/?p=45#comments</comments>
		<pubDate>Thu, 17 Nov 2011 16:35:21 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[Developer Tips]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[EntityFramework]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[VisualStudio]]></category>

		<guid isPermaLink="false">http://brightstardb.com/blog/?p=45</guid>
		<description><![CDATA[In this tutorial we are going to create a Custom Membership Provider that will enable an MVC3 Web Application to use BrightstarDB as our datasource.]]></description>
			<content:encoded><![CDATA[<p>Custom Membership Providers are a quick and straightforward way of managing membership information when you wish to store that membership data in a datasource that is not supported by the membership providers included within the .NET framework. Often developers will need to implement custom membership providers even when storing the data in a supported datasource, because the schema of that membership information differs from that in the default providers.</p>
<p>In this tutorial we are going to create a Custom Membership Provider that will enable an MVC3 Web Application to use BrightstarDB as our datasource.</p>
<h2>Part 1: Creating a new project and adding a Custom Membership Provider</h2>
<ol>
<li>Open Visual Studio 2010 and create a new MVC3 Web Application</li>
<li><strong>Important:</strong> choose &#8216;Internet Application&#8217; when asked, which will pre-populate your application with the models, views and controller needed to have basic login functionality</li>
<li>Add a new class to your project and name it BrightstarMembershipProvider.cs</li>
<li>Make this new class inherit from the MembershipProvider class (System.Web.Security namespace)</li>
<li>Right click on the MembershipProvider class name and choose “Implement abstract class” from the context menu, this automatically creates all the override methods that your custom class can implement.</li>
<li>Make sure that your project has references to the BrightstarDB DLLs that are available in the SDK</li>
<li>Add a Brightstar Entity Context to your project, naming it NerdDinnerContext.tt (see the <a title="Developing with BrightstarDB" href="http://brightstardb.com/documentation/Developing_with_BrightstarDB.html">documentation for Developing with BrightstarDB</a> for more details)</li>
<li>Add a new interface to the Models directory and name it INerdDinnerLogin.cs</li>
<li>Add the [Entity] attribute to the interface, and add the properties shown below:</li>
<li>The Id property is decorated with the Identifier attribute to allow us to work with simpler string values rather than the full URI that is generated by BrightstarDB (for more information, please read the <a href="http://brightstardb.com/documentation/Entity_Framework.html">Entity Framework Documentation</a>).</li>
</ol>
<p><script type="text/javascript" src="https://gist.github.com/1373576.js?file=INerdDinnerLogin.cs"></script>To update the Brightstar Entity Context, right click on the NerdDinnerContext.tt file and select “Run Custom Tool” from the context menu.</p>
<h2>Part 2: Configuring the application to use the Brightstar Membership Provider</h2>
<p>First we must add a connection string to the Web.Config so that the Brightstar Service can connect to the store<script type="text/javascript" src="https://gist.github.com/1373576.js?file=Web.Config%20connection%20string"></script></p>
<p>To configure your web application to use this custom Membership Provider, we simply need to change the configuration values in the Web.config file in the root directory of the application. Change the membership node contained within the &lt;system.web&gt; to the snippet below:<script type="text/javascript" src="https://gist.github.com/1373576.js?file=Web.Config"></script></p>
<h2>Part 3: Adding functionality to the Custom Membership Provider</h2>
<p><em>Note – for the purpose of keeping this example simple, we will leave some of these methods to throw NotImplementedException, but you can add in whatever logic suits your business requirements once you have the basic functionality up and running.</em> The full code is given below, but can be broken down as follows:</p>
<h3>Initialization</h3>
<p>We add an Initialize() method along with a GetConfigValue() helper method to handle retrieving the configuration values from Web.config, and setting default values if it is unable to retrieve a value.</p>
<h3>Private helper methods</h3>
<p>We add three more helper methods: CreateSalt() and CreatePasswordHash() to help us with user passwords, and ConvertLoginToMembershipUser() to return a built in .NET MembershipUser object when given the BrightstarDB INerdDinnerLogin entity.</p>
<h3>CreateUser()</h3>
<p>The CreateUser() method is used when a user registers on our site, the first part of this code validates based on the configuration settings (such as whether an email must be unique) and then creates a NerdDinnerLogin entity, adds it to the NerdDinnerContext and saves the changes to the BrightstarDB store.</p>
<h3>GetUser()</h3>
<p>The GetUser() method simply looks up a login in the BrightstarDB store, and returns a .NET MembershipUser object with the help of the ConvertLoginToMembershipUser() method mentioned above.</p>
<h3>GetUserNameByEmail()</h3>
<p>The GetUserNameByEmail() method is similar to the GetUser() method but looks up by email rather than username. It&#8217;s used by the CreateUser() method if the configuration settings specify that new users must have unique emails.</p>
<h3>ValidateUser()</h3>
<p>The ValidateUser() method is used when a user logs in to our web application. The login is looked up in the BrightstarDB store by username, and then the password is checked. If the checks pass successfully then it returns a true value which enables the user to successfully login.  <script type="text/javascript" src="https://gist.github.com/1373576.js?file=BrightstarMembershipProvider.cs"></script></p>
<p>&nbsp;</p>
<h2>Part 4: Running the application</h2>
<p>Press F5 to run the application. You will notice a [Log On] link in the top right hand corner of the screen. You can navigate to the registration page via the logon page.</p>
<p>&nbsp;</p>
<div id="attachment_73" class="wp-caption aligncenter" style="width: 310px"><a href="http://brightstardb.com/blog/wp-content/uploads/2011/11/1_register.png" rel="lightbox[45]"><img class="size-medium wp-image-73" title="Register" src="http://brightstardb.com/blog/wp-content/uploads/2011/11/1_register-300x280.png" alt="Register" width="300" height="280" /></a><p class="wp-caption-text">Register</p></div>
<p>Choosing a username, email and password will create a login entity for you in the BrightstarDB store, and automatically log you in.</p>
<div id="attachment_74" class="wp-caption aligncenter" style="width: 310px"><a href="http://brightstardb.com/blog/wp-content/uploads/2011/11/2_loggedin.png" rel="lightbox[45]"><img class="size-medium wp-image-74" title="Logged In" src="http://brightstardb.com/blog/wp-content/uploads/2011/11/2_loggedin-300x130.png" alt="Logged In" width="300" height="130" /></a><p class="wp-caption-text">Logged In</p></div>
<p>The partial view that contains the login link code recognises that you are logged in and displays your username and a [Log Off] link. Clicking the links clears the cookies that keep you logged in to the website, and you can log on again by entering your username and password.</p>
<div id="attachment_75" class="wp-caption aligncenter" style="width: 310px"><a href="http://brightstardb.com/blog/wp-content/uploads/2011/11/3_logon.png" rel="lightbox[45]"><img class="size-medium wp-image-75" title="LogOn" src="http://brightstardb.com/blog/wp-content/uploads/2011/11/3_logon-300x236.png" alt="LogOn" width="300" height="236" /></a><p class="wp-caption-text">LogOn</p></div>
<h2>Summary</h2>
<p>In this tutorial we have walked through some simple steps to use a Custom Membership Provider to allow BrightstarDB to handle the authentication of users on your MVC3 Web Application.<br />
For simplicity, we have kept the same structure of membership information as we would find in a default provider, but you can expand on this sample to include extra membership information by simply adding more properties to the BrightstarDB entity.<br />
If you have any questions or queries, please post them in the <a href="http://brightstardb.com/community/">BrightstarDB User Group</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://brightstardb.com/blog/?feed=rss2&#038;p=45</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Entity Framework Getting Started &#8211; A Short Video</title>
		<link>http://brightstardb.com/blog/?p=40</link>
		<comments>http://brightstardb.com/blog/?p=40#comments</comments>
		<pubDate>Wed, 16 Nov 2011 07:58:50 +0000</pubDate>
		<dc:creator>gra</dc:creator>
				<category><![CDATA[Developer Tips]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[EntityFramework]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[VisualStudio]]></category>

		<guid isPermaLink="false">http://brightstardb.com/blog/?p=40</guid>
		<description><![CDATA[With BrightstarDB we have tried to keep the overhead of creating a persistent data model down to a minimum. The goal is to create a great experience that doesn't prevent developers from building the model they want to build or from focusing on the problems they need to solve. Follow the link to a short video that shows how to get started using the BrightstarDB Entity Framework from inside Visual Studio 2010.]]></description>
			<content:encoded><![CDATA[<p>This short video shows how to get started using the BrightstarDB Entity Framework from inside Visual Studio 2010. With BrightstarDB we have tried to keep the overhead of creating a persistent data model down to a minimum. The goal is to create a great experience that doesn&#8217;t prevent developers from building the model they want to build or from focusing on the problems they need to solve.</p>
<p><iframe src="http://www.youtube.com/embed/SWY3y3CZS20?rel=0&amp;autohide=1&amp;theme=light&amp;color=white&amp;showinfo=0" frameborder="0" width="560" height="315"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://brightstardb.com/blog/?feed=rss2&#038;p=40</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable SPARQL query in your MVC3 application</title>
		<link>http://brightstardb.com/blog/?p=28</link>
		<comments>http://brightstardb.com/blog/?p=28#comments</comments>
		<pubDate>Mon, 14 Nov 2011 09:53:57 +0000</pubDate>
		<dc:creator>Kal</dc:creator>
				<category><![CDATA[Developer Tips]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[SPARQL]]></category>

		<guid isPermaLink="false">http://brightstardb.com/blog/?p=28</guid>
		<description><![CDATA[BrightstarDB uses SPARQL as its primary query language. Because of this and because all the entities you create with the BrightstarDB entity framework are RDF resources, it is possible to turn your application into a part of the Linked Data web with just a few lines of code. The easiest way to achieve this is...<br/><a href="http://brightstardb.com/blog/?p=28">Read the full post</a>]]></description>
			<content:encoded><![CDATA[<p>BrightstarDB uses SPARQL as its primary query language. Because of this and because all the entities you create with the BrightstarDB entity framework are RDF resources, it is possible to turn your application into a part of the Linked Data web with just a few lines of code. The easiest way to achieve this is to add a controller for running SPARQL queries.</p>
<p><script src="https://gist.github.com/1358776.js?file=SparqlController.cs"></script></p>
<p>As shown in the code above, all you need to do in the code is create a client instance (when using no parameters like this, the connection string is read from your web.config file). The client you get back is actually a BrightstarDB service client and is not tied to the store specified in your connection string, so you need to provide the store name as a parameter to ExecuteQuery (in this case &#8220;NerdDinner&#8221;). The result of the ExecuteQuery method is a stream containing the SPARQL results in XML format, so all you need to do is wrap this stream in a FileStreamResult and set an appropriate media type. The [ValidateInput(false)] decoration is required because SPARQL queries contain characters such as < and > which ASP.NET considers harmful, if you omit this attribute you will get an exception thrown from ASP.NET.</p>
<p>Now you can query the SPARQL endpoint like this:</p>
<p>http://localhost:49608/sparql?query=SELECT ?d ?o WHERE {?d a &lt;http://brightstardb.com/namespaces/default/Dinner&gt;}</p>
]]></content:encoded>
			<wfw:commentRss>http://brightstardb.com/blog/?feed=rss2&#038;p=28</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BrightstarDB Blog</title>
		<link>http://brightstardb.com/blog/?p=7</link>
		<comments>http://brightstardb.com/blog/?p=7#comments</comments>
		<pubDate>Fri, 11 Nov 2011 08:46:05 +0000</pubDate>
		<dc:creator>Kal</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://brightstardb.com/blog/?p=7</guid>
		<description><![CDATA[Welcome to the BrightstarDB Blog. This blog will host articles, videos and how-to&#8217;s all about BrightstarDB. BrightstarDB is a revolution in data solutions. It provides a native .NET, schema-free, NoSQL triple store with fabulous performance, and a complete, code first, Entity Framework with full LINQ capabilities. In building BrightstarDB we wanted to deliver the ultimate...<br/><a href="http://brightstardb.com/blog/?p=7">Read the full post</a>]]></description>
			<content:encoded><![CDATA[<p>Welcome to the BrightstarDB Blog. This blog will host articles, videos and how-to&#8217;s all about BrightstarDB.</p>
<p>BrightstarDB is a revolution in data solutions. It provides a native .NET, schema-free, NoSQL triple store with fabulous performance, and a complete, code first, Entity Framework with full LINQ capabilities.</p>
<p>In building BrightstarDB we wanted to deliver the ultimate tool to .NET developers to quickly build and deploy high performance persistent object-oriented and semantic web solutions.</p>
<p>We have now released the developer preview and are really excited to get feedback from developers. We believe the developer experience and database performance is really great but we&#8217;d like to hear what you think. If you have some time and are interested in working with the next generation of persistent data solutions then please <a title="Register to download BrightstarDB Developer Preview" href="http://brightstardb.com/download/">register to get access to the developer preview</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://brightstardb.com/blog/?feed=rss2&#038;p=7</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

