Permalink
Browse files

Merge pull request #5 from hmobius/master

Stylesheet fixes and section0/1 tweaks
  • Loading branch information...
2 parents ddf8bd8 + 436cbec commit acbb51b0d300e93624608fb29cc8d701ba0e0ef8 @hmobius hmobius committed Apr 16, 2012
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -15,9 +15,9 @@ <h2>Notes on the Documentation for Simple.Data</h2>
<h3>Sample Code</h3>
<p>All samples in this documentation are part of the Simple.Data.Sample package which you can download as a NuGet package or from github at <a href="https://github.com/markrendle/Simple.Data.Sample">https://github.com/markrendle/Simple.Data.Sample</a></p>
<ul>
- <li>All code snippets in the documentation assume that there is a variable db which was returned from one of the Simple.Data Database.Open...(...) methods.</li>
+ <li>All code snippets in the documentation assume that there is a variable db which was returned from one of the Simple.Data <code class="method">Database.Open*()</code> methods.</li>
<li>Unless explicitly mentioned, all code snippets which run an operation against the database will also show the SQL generated by that code using the ADO adapter and the SqlServer provider. Obviously Simple.Data is not just a SQL wrapper, but this convention should be most easily understood by the widest audience.</li>
- <li>In the &#8216;Generated SQL&#8217; code, parameters will be shown as simple assignments before the SQL in which they are used. This is just a convenient shorthand notation and not valid SQL. At runtime in the ADO adapter, parameters are handled through the IDbCommand.Parameters collection.</li>
+ <li>In the &#8216;Generated SQL&#8217; code, parameters will be shown as simple assignments before the SQL in which they are used. This is just a convenient shorthand notation and not valid SQL. At runtime in the ADO adapter, parameters are handled through the <code class="object">IDbCommand.Parameters</code> collection.</li>
</ul>
</body>
</html>
@@ -1,11 +1,11 @@
<!DOCTYPE html>
<html>
<head>
- <title>What is SImple.Data?</title>
+ <title>What is Simple.Data?</title>
</head>
<body>
-<h2>What is SImple.Data?</h2>
-<p>SImple.Data is a lightweight framework that uses the dynamic features of .NET 4 to provide an expressive, ORM-ish way of accessing and manipulating data without any of the code pre-generation and boilerplate required by other frameworks. Instead, it interprets method and property names at runtime and maps them to your underlying data-store using a convention-based approach. It does not permit SQL Injection. It was built by Mark Rendle <a href="http://blog.markrendle.net/2010/08/05/introducing-simple-data/">in reaction to Microsoft&#8217;s release of Microsoft.Data.dll</a>, taking Ruby’s <a href="http://ar.rubyonrails.org/">ActiveRecord</a> and <a href="http://datamapper.org/">DataMapper</a> gems as its inspiration.</p>
+<h2>What is Simple.Data?</h2>
+<p>Simple.Data is a lightweight framework that uses the dynamic features of .NET 4 to provide an expressive, ORM-ish way of accessing and manipulating data without any of the code pre-generation and boilerplate required by other frameworks. Instead, it interprets method and property names at runtime and maps them to your underlying data-store using a convention-based approach. It does not permit SQL Injection. It was built by Mark Rendle <a href="http://blog.markrendle.net/2010/08/05/introducing-simple-data/">in reaction to Microsoft&#8217;s release of Microsoft.Data.dll</a>, taking Ruby&#8217;s <a href="http://ar.rubyonrails.org/">ActiveRecord</a> and <a href="http://datamapper.org/">DataMapper</a> gems as its inspiration.</p>
<blockquote>&#8220;It&#8217;s not an O/RM. It looks a bit like one, but it doesn&#8217;t need objects, it doesn&#8217;t need a relational database, and it doesn&#8217;t need any mapping configuration. So it&#8217;s an O/RM without the O or the R or the M. So it&#8217;s just a /.&#8221;</blockquote>
<p>Let&#8217;s take an example</p>
<pre class="brush:csharp">public Album FindAlbumByTitle(string title)
@@ -14,9 +14,9 @@ <h2>What is SImple.Data?</h2>
}</pre>
<p>In this example,</p>
<ul>
- <li>Database.Open() is dynamic and has no pre-defined Albums property.</li>
- <li>Albums is returned as a DynamicTable, which is also dynamic. It has no pre-defined FindByTitle method.</li>
- <li>When Simple.Data sees a call to a FindBy* method, it pulls apart the rest of the method name, combines it with the arguments and builds an ADO.NET command which safely encapsulates the name and password values inside parameters.</li>
+ <li><code class="method">Database.Open()</code> is dynamic and has no pre-defined <code class="property">Albums</code> property.</li>
+ <li><code class="property">Albums</code> is returned as a <code class="type">DynamicTable</code>, which is also dynamic. It has no pre-defined <code class="method">FindByTitle()</code> method.</li>
+ <li>When Simple.Data sees a call to a <code class="method">FindBy*()</code> method, it pulls apart the rest of the method name, combines it with the arguments and builds an ADO.NET command which safely encapsulates the name and password values inside parameters.</li>
</ul>
<p>Assuming you&#8217;re using Simple.Data to access a SQL-based database, the following SQL (or similar depending on your database) is generated along with the requisite boilerplate code to send it to the database and retrieve the resulting data.</p>
<pre class="brush:sql">SELECT * FROM Albums WHERE Title = @p1</pre>
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Configuration</title>
-</head>
-<body>
-<h2>Configuration</h2>
-<p>Once you&#8217;ve downloaded the required Simple.Data assemblies, you have the option to store your data store&#8217;s connection details in your program&#8217;s configuration file. Simple.Data looks for no other information from this file.</p>
-<p>You have two options for storing a Simple.Data connection string in a config file.</p>
-<p><strong>1. Use the default connection string name.</strong></p>
-<pre class="brush:xml">&lt;configuration&gt;
- &lt;connectionStrings&gt;
- &lt;add name="Simple.Data.Properties.Settings.DefaultConnectionString"
- connectionString="Data Source=.\SQL2K8;Initial Catalog=MvcMusicStore;Integrated Security=True" /&gt;
- &lt;/connectionStrings&gt;
- &lt;/configuration&gt;</pre>
-<p>Then you can open this database with the parameterless Open method:</p>
-<pre class="brush:csharp">var db = Database.Open();</pre>
-<p><strong>2. Store it as a named connection string</strong></p>
-<pre class="brush:xml">&lt;configuration&gt;
- &lt;connectionStrings&gt;
- &lt;add name="MvcMusicStoreDB"
- connectionString="Data Source=.\SQL2K8;Initial Catalog=MvcMusicStore;Integrated Security=True" /&gt;
- &lt;/connectionStrings&gt;
- &lt;/configuration&gt;</pre>
-<p>Then you can open this database with the OpenNamedConnection method:</p>
-<pre class="brush:csharp">var db = Database.OpenNamedConnection("MvcMusicStoreDB");</pre>
-</body>
-</html>
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Configuration</title>
+</head>
+<body>
+<h2>Configuration</h2>
+<p>Once you&#8217;ve downloaded the required Simple.Data assemblies, you have the option to store your data store&#8217;s connection details in your program&#8217;s configuration file. Simple.Data looks for no other information from this file.</p>
+<p>You have two options for storing a Simple.Data connection string in a config file.</p>
+<h3>Use the default connection string name.</h3>
+<pre class="brush:xml">&lt;configuration&gt;
+ &lt;connectionStrings&gt;
+ &lt;add name="Simple.Data.Properties.Settings.DefaultConnectionString"
+ connectionString="--Your connection string--" /&gt;
+ &lt;/connectionStrings&gt;
+&lt;/configuration&gt;</pre>
+<p>Then you can open this database with the parameterless <code class="method">Open()</code> method:</p>
+<pre class="brush:csharp">var db = Database.Open();</pre>
+<hr>
+<h3>Store it as a named connection string</h3>
+<pre class="brush:xml">&lt;configuration&gt;
+ &lt;connectionStrings&gt;
+ &lt;add name="MvcMusicStoreDB"
+ connectionString="--Your connection string" /&gt;
+ &lt;/connectionStrings&gt;
+&lt;/configuration&gt;</pre>
+<p>Then you can open this database with the <code class="method">OpenNamedConnection()</code> method:</p>
+<pre class="brush:csharp">var db = Database.OpenNamedConnection("MvcMusicStoreDB");</pre>
+</body>
+</html>
@@ -5,16 +5,15 @@
</head>
<body>
<h2>Using a Shared Connection</h2>
-<p><strong>[ADOAdapter Only]</strong></p>
-<p>SImple.Data&#8217;s aggressive attitude to closing database connections may not be optimal for you, but it is possible to</p>
+<p class="alert">[ADOAdapter Only]</p>
+<p>Simple.Data&#8217;s aggressive attitude to closing database connections may not be optimal for you, but it is possible to</p>
<ul>
- <li>create and open a connection outside of Simple.Data (e.g. a SqlConnection)</li>
+ <li>create and open a connection outside of Simple.Data (e.g. a <code class="type">SqlConnection</code>)</li>
<li>force Simple.Data to share that one open connection across all its databases operations</li>
<li>close the connection at your discretion</li>
</ul>
-<p>The Simple.Data.Ado adaptor includes the <strong>UseSharedConnection()</strong> and <strong>StopUsingSharedConnection()</strong> methods for this purpose</p>
- <pre class="brush:csharp">public readonly string MagicConnection =
- @"Data Source=.\SQL2K8;Initial Catalog=MvcMusicStore;Integrated Security=True";
+<p>The <code class="type">Simple.Data.Ado</code> adaptor includes the <code class="method">UseSharedConnection()</code> and <code class="method">StopUsingSharedConnection()</code> methods for this purpose</p>
+ <pre class="brush:csharp;highlight:[4,6,17]">public readonly string MagicConnection = "--Your connection string--";
var db = Database.OpenConnection(MagicConnection);
SqlConnection conn = new SqlConnection(MagicConnection);
@@ -6,26 +6,29 @@
<body>
<h2>Opening A Connection</h2>
<p>Once you&#8217;ve set up your connection strings in your configuration file (or not), the first action to have your code take is to open your data store. You can use one of four methods to do this.</p>
-<p><strong>public static dynamic Open();</strong><br>
- Tries to open a connection to a data store using the connection string named <em>Simple.Data.Properties.Settings.DefaultConnectionString</em> in your configuration file</p>
+<h3>Open</h3>
+<p>Tries to open a connection to a data store using the connection string named <code class="value">Simple.Data.Properties.Settings.DefaultConnectionString</code> in your configuration file</p>
<pre class="brush:csharp">var defaultDb = Database.Open();
var artist = defaultDb.Artists.FindByName("Aerosmith");
Console.WriteLine("Id: {0}, Name: {1}", artist.ArtistId, artist.Name);</pre>
-<p><strong>public static dynamic OpenNamedConnection(string connectionName);</strong><br>
- Tries to open a connection to a data store using the connection string with the given <em>connectionName</em> in your configuration file</p>
+<hr>
+<h3>OpenNamedConnection(string connectionName)</h3>
+<p>Tries to open a connection to a data store using the connection string with the given <code class="parameter">connectionName</code> in your configuration file</p>
<pre class="brush:csharp">var namedDb = Database.OpenNamedConnection("MvcMusicStoreDb");
var artist2 = namedDb.Artists.FindByName("Metallica");
Console.WriteLine("Id: {0}, Name: {1}", artist2.ArtistId, artist2.Name);</pre>
-<p><strong>public static dynamic OpenConnection(string connectionString);</strong>
- Tries to open a connection to a data store with the given literal <em>connectionString</em>.</p>
-<pre class="brush:csharp">var magicDb = Database.OpenConnection(@"Data Source=.\SQL2K8;Initial Catalog=MvcMusicStore;Integrated Security=True");
+<hr>
+<h3>OpenConnection(string connectionString)</h3>
+<p>Tries to open a connection to a data store with the given literal <code class="parameter">connectionString</code>.</p>
+<pre class="brush:csharp">var magicDb = Database.OpenConnection("--Your Connection String--");
var artist3 = magicDb.Artists.FindByName("Iron Maiden");
Console.WriteLine("Id: {0}, Name: {1}", artist3.ArtistId, artist3.Name);</pre>
-<p><strong>public static dynamic OpenFile(string filepath);</strong>
- Tries to open a connection to a data store with the given <em>filepath</em>.</p>
+<hr>
+<h3>OpenFile(string filepath)</h3>
+<p>Tries to open a connection to a data store with the given <code class="parameter">filepath</code>.</p>
<pre class="brush:csharp">var fileDb = Database.OpenConnection("MvcMusicStore.sdf");
var artist4 = fileDb.Artists.FindByName("Alanis Morrisette");
Console.WriteLine("Id: {0}, Name: {1}", artist4.ArtistId, artist4.Name);</pre>
-<p>Simple.Data is quite aggressive in closing connections and holds no open connections to a data store by default, so you can keep the db object returned from the Open methods hanging around without worrying.</p>
+<p>Simple.Data is quite aggressive in closing connections and holds no open connections to a data store by default, so you can keep the <code class="type">Database</code> object returned from the <code class="method">Open*()</code> methods hanging around without worrying.</p>
</body>
</html>
@@ -1,67 +1,23 @@
-h1 {
- font-family: "Open Sans", sans-serif;
- font-size: 2em;
- font-weight: 300;
- display: inline;
-}
-h2 {
- font-family: "Open Sans", sans-serif;
- font-size: 1.25em;
- margin: 8px;
-}
-h3 {
- font-family: "Open Sans", sans-serif;
- font-size: 1em;
- margin: 8px;
-}
-h4 {
- font-family: "Open Sans", sans-serif;
- font-size: 0.8em;
- margin: 8px;
-}
-p {
- margin-left: 8px;
- margin-right: 8px;
-}
-code {
- margin: 16px;
- padding: 8px;
- font-family: Inconsolata, Consolas, Courier;
-}
-pre {
- word-wrap: normal;
-}
-ul {
- list-style: none;
- text-indent: -1em;
-}
-li a {
- color: #f5f5f5;
- text-decoration: none;
- font-family: "Open Sans", sans-serif;
- font-size: 0.9em;
-}
-li a:hover {
- color: #ffffff;
- /*text-decoration: underline;*/
-}
#wrap {
- width:760px;
+ width:960px;
margin:0 auto;
- font-family: Garamond, Palatino, serif;
+ font-family: Georgia, serif;
}
#header {
background:#ffffff;
}
#main {
float:left;
- width:550px;
- background:#f9f9f9;
+ width:690px;
+ margin-right:10px;
+}
+#main ul li {
+ padding:0 0 5px 0;
}
#nav {
padding-left: 4px;
float:right;
- width:206px;
+ width:256px;
color:#f5f5f5;
background: #2e3192; /* Old browsers */
background: -moz-linear-gradient(left, #2e3192 0%, #173296 52%, #0071bc 100%); /* FF3.6+ */
@@ -72,6 +28,51 @@ li a:hover {
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2e3192', endColorstr='#0071bc',GradientType=1 ); /* IE6-9 */
background: linear-gradient(left, #2e3192 0%,#173296 52%,#0071bc 100%); /* W3C */
}
+#nav ul {
+ list-style: none;
+ margin-left: 0;
+ padding-left: 1em;
+}
+#nav li a {
+ color:#f5f5f5;
+ text-decoration: none;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 0.9em;
+}
+#nav li a:hover {
+ text-decoration: underline;
+}
+h1 {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 2em;
+ font-weight: 300;
+ display: inline;
+}
+h2 {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 1.25em;
+ margin-bottom: 0;
+}
+h3 {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 1em;
+ margin-bottom: 0;
+}
+h4 {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 0.8em;
+ margin-bottom: 0;
+}
+p
+{
+ margin-top : 4px;
+}
+p.alert
+{
+ margin: 16px 0 4px 0;
+ color: red;
+ font-style: italic;
+}
#footer {
clear:both;
}
@@ -80,3 +81,20 @@ img.logo
vertical-align: middle;
margin-right: 16px;
}
+code
+{
+ font-family: Georgia, serif;
+ font-style:italic;
+}
+code.method
+{
+ color: #7f006e;
+}
+code.parameter, code.property, code.value
+{
+ color: #008000;
+}
+code.object, code.type
+{
+ color: #0066cc;
+}
@@ -47,7 +47,7 @@
font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important;
font-weight: normal !important;
font-style: normal !important;
- font-size: 1em !important;
+ font-size: 14px !important;
min-height: inherit !important;
min-height: auto !important;
}
Deleted file not rendered
View
@@ -1,19 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Test</title>
- <link href='http://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
- <link href='http://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
- <link type="text/css" rel="stylesheet" href="css/docs.css" />
+ <title>SimpleData Documentation</title>
<link type="text/css" rel="stylesheet" href="css/shCore.css" />
<link type="text/css" rel="stylesheet" href="css/shThemeDefault.css" />
+ <link type="text/css" rel="stylesheet" href="css/docs.css" />
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.1.7/underscore-min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
- <script type="text/javascript" src="http://code.jquery.com/ui/1.8.15/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/jquery.address-1.4.js"></script>
<script type="text/javascript" src="js/shCore.js"></script>
- <script type="text/javascript" src="css/shBrushCSharp.js"></script>
- <script type="text/javascript" src="css/shBrushSql.js"></script>
+ <script type="text/javascript" src="js/shBrushCSharp.js"></script>
+ <script type="text/javascript" src="js/shBrushSql.js"></script>
+ <script type="text/javascript" src="js/shBrushXml.js"></script>
<script type="text/javascript" src="js/docs.js"></script>
</head>
<body>
@@ -32,5 +30,8 @@ <h2>Hello.</h2>
</div>
<div id="footer"><a href='http://www.pledgie.com/campaigns/15965'><img alt='Click here to lend your support to: Simple.Data and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/15965.png?skin_name=chrome' border='0' /></a></div>
</div>
+ <script type="text/javascript">
+ SyntaxHighlighter.all()
+</script>
</body>
</html>
Oops, something went wrong.

0 comments on commit acbb51b

Please sign in to comment.