Permalink
Browse files

Created gh-pages branch via GitHub

  • Loading branch information...
0 parents commit 611f8aa379411e82457169b4daf152864395a25f @emiliotorrens committed May 8, 2012
Showing with 626 additions and 0 deletions.
  1. BIN images/checker.png
  2. +189 −0 index.html
  3. +20 −0 javascripts/scale.fix.js
  4. +1 −0 params.json
  5. +60 −0 stylesheets/pygment_trac.css
  6. +356 −0 stylesheets/styles.css
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,189 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <title>Mongomapper.net by emiliotorrens</title>
+
+ <link rel="stylesheet" href="stylesheets/styles.css">
+ <link rel="stylesheet" href="stylesheets/pygment_trac.css">
+ <script src="javascripts/scale.fix.js"></script>
+ <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+ <!--[if lt IE 9]>
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+ <div class="wrapper">
+ <header>
+ <h1>Mongomapper.net</h1>
+ <p>A .NET Object Mapper for MongoDB over MongoDB C# Driver</p>
+ <p class="view"><a href="https://github.com/emiliotorrens/MongoMapper.NET">View the Project on GitHub <small>emiliotorrens/MongoMapper.NET</small></a></p>
+ <ul>
+ <li><a href="https://github.com/emiliotorrens/MongoMapper.NET/zipball/master">Download <strong>ZIP File</strong></a></li>
+ <li><a href="https://github.com/emiliotorrens/MongoMapper.NET/tarball/master">Download <strong>TAR Ball</strong></a></li>
+ <li><a href="https://github.com/emiliotorrens/MongoMapper.NET">View On <strong>GitHub</strong></a></li>
+ </ul>
+ </header>
+ <section>
+ <h2>MongoMapper.NET</h2>
+
+<p>A .NET Object Mapper for MongoDB over MongoDB C# Driver</p>
+
+<h3>Dependencies</h3>
+
+<ul>
+<li><a href="http://www.mongodb.org/downloads">MongoDB distributions</a></li>
+<li><a href="http://github.com/mongodb/mongo-csharp-driver">MongoDB Driver for CSharp</a></li>
+<li><a href="http://github.com/ServiceStack/ServiceStack.Text">ServiceStack.Text</a></li>
+<li>
+<a href="http://www.nunit.org">NUnit</a>, <a href="http://nunitforvs.codeplex.com">NUnit for Visual Studio</a>
+</li>
+</ul><h3>Defining the Model</h3>
+
+<pre><code>[MongoKey(KeyFields = "Code")]
+public class Country: MongoMapper
+{
+ [MongoDownRelation(ObjectName = "Person", FieldName = "Country")]
+ public string Code { get; set; }
+ public string Name { get; set; }
+
+ [MongoPropertyValidator(PropertyName="Code")]
+ public void CodeIsUp(string CountryCode)
+ {
+ if (CountryCode != CountryCode.ToUpper())
+ throw new Exception(String.Format("{0} must be {1}", CountryCode, CountryCode.ToUpper()));
+ }
+}
+
+[MongoKey(KeyFields = "")]
+[MongoIndex(IndexFields = "ID,Country")]
+[MongoIndex(IndexFields = "Name")]
+[MongoMapperIdIncrementable(IncremenalId = true, ChildsIncremenalId = true)]
+public class Person : MongoMapper
+{
+ public Person()
+ {
+ Childs = new List&lt;Child&gt;();
+ }
+
+ public string Name { get; set; }
+ public int Age { get; set; }
+ public DateTime BirthDate { get; set; }
+ public bool Married { get; set; }
+ public decimal BankBalance { get; set; }
+
+ [MongoUpRelation(ObjectName = "Country", FieldName = "Code")]
+ public string Country { get; set; }
+
+ [MongoChildCollection]
+ public List&lt;Child&gt; Childs { get; set;}
+}
+</code></pre>
+
+<h3>Work with the Model</h3>
+
+<pre><code> Country c = new Country {Code = "es", Name = "España"};
+ try
+ {
+ c.Save();
+ }
+ catch(Exception ex)
+ {
+ Assert.AreEqual(ex.GetBaseException().GetType(), typeof(ValidatePropertyException));
+ c.Code = "ES";
+ c.Save();
+ }
+
+ c = new Country { Code = "UK", Name = "Reino Unido" };
+ c.Save();
+
+ c = new Country { Code = "UK", Name = "Reino Unido" };
+ try
+ {
+ c.Save();
+ }
+ catch (Exception ex)
+ {
+ Assert.AreEqual(ex.GetBaseException().GetType(),typeof(DuplicateKeyException));
+ }
+
+ Country c2 = new Country { Code = "US", Name = "Francia" };
+ c2.OnBeforeInsert += (s, e) =&gt; { ((Country)s).Name = "Estados Unidos"; };
+ c2.Save();
+
+ Country c3 = new Country();
+ c3.FillByKey("US");
+ Assert.AreEqual(c3.Name, "Estados Unidos");
+
+ List&lt;Country&gt; countries = new List&lt;Country&gt;();
+ countries.MongoFind();
+ Assert.AreEqual(countries.Count, 3);
+
+ countries.MongoFind(Query.Or(MongoQuery.Eq((Country co) =&gt; co.Code, "ES"), MongoQuery.Eq((Country co) =&gt; co.Code, "UK")));
+ Assert.AreEqual(countries.Count, 2);
+
+ Person p = new Person
+ {
+ Name = "Pepito Perez",
+ Age = 35,
+ BirthDate = DateTime.Now.AddDays(57).AddYears(-35),
+ Married = true,
+ Country = "XXXXX",
+ BankBalance = decimal.Parse("3500,00")
+ };
+
+ p.Childs.Add(new Child() { ID = 1, Age = 10, BirthDate = DateTime.Now.AddDays(57).AddYears(-10), Name = "Juan Perez" });
+
+ try
+ {
+ p.Save();
+ }
+ catch (Exception ex)
+ {
+ Assert.AreEqual(ex.GetBaseException().GetType(), typeof(ValidateUpRelationException));
+ p.Country = "ES";
+ p.Save();
+ }
+
+ p.ServerUpdate(Update.PushWrapped("Childs", new Child() { ID = 2, Age = 2, BirthDate = DateTime.Now.AddDays(57).AddYears(-7), Name = "Ana Perez" }));
+
+ List&lt;Person&gt; persons = new List&lt;Person&gt;();
+ persons.MongoFind("Childs.Age",2);
+ Assert.AreEqual(persons.Count, 1);
+</code></pre>
+
+<h3>You can find examples in the Test Project</h3>
+
+<ul>
+<li>
+<a href="https://github.com/emiliotorrens/MongoMapper.NET/tree/master/EtoolTech.MongoDB.Mapper.Test.NUnit/Classes">Class Definition</a> </li>
+<li><a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/FindTest.cs">Find</a></li>
+<li><a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/InsertModifyDeleteTest.cs">Write</a></li>
+<li><a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/IncrementalIdTest.cs">Incremental ID</a></li>
+<li>
+<a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/RelationsTest.cs">Relations</a> </li>
+<li><a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/EventsTest.cs">Events</a></li>
+<li><a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/ExtensionTest.cs">Extension Methods</a></li>
+<li><a href="https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/OriginalObjectTest.cs">Original Version</a></li>
+</ul><h3>Change Log</h3>
+
+<ul>
+<li><a href="http://bit.ly/uy80RE">30/12/2011</a></li>
+<li><a href="http://bit.ly/yfcsn4">05/01/2012</a></li>
+<li><a href="http://bit.ly/AfGfKC">02/02/2012</a></li>
+<li><a href="http://bit.ly/zvnk0F">14/02/2012</a></li>
+<li><a href="http://bit.ly/wMX6Ha">07/03/2012</a></li>
+<li><a href="http://bit.ly/GAIbez">20/03/2012</a></li>
+</ul>
+ </section>
+ </div>
+ <footer>
+ <p>Project maintained by <a href="https://github.com/emiliotorrens">emiliotorrens</a></p>
+ <p>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></p>
+ </footer>
+ <!--[if !IE]><script>fixScale(document);</script><!--<![endif]-->
+
+ </body>
+</html>
@@ -0,0 +1,20 @@
+fixScale = function(doc) {
+
+ var addEvent = 'addEventListener',
+ type = 'gesturestart',
+ qsa = 'querySelectorAll',
+ scales = [1, 1],
+ meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
+
+ function fix() {
+ meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
+ doc.removeEventListener(type, fix, true);
+ }
+
+ if ((meta = meta[meta.length - 1]) && addEvent in doc) {
+ fix();
+ scales = [.25, 1.6];
+ doc[addEvent](type, fix, true);
+ }
+
+};
@@ -0,0 +1 @@
+{"name":"Mongomapper.net","body":"## MongoMapper.NET\r\n\r\nA .NET Object Mapper for MongoDB over MongoDB C# Driver\r\n\r\n### Dependencies\r\n\r\n* [MongoDB distributions] (http://www.mongodb.org/downloads)\r\n* [MongoDB Driver for CSharp] (http://github.com/mongodb/mongo-csharp-driver)\r\n* [ServiceStack.Text] (http://github.com/ServiceStack/ServiceStack.Text)\r\n* [NUnit] (http://www.nunit.org), [NUnit for Visual Studio] (http://nunitforvs.codeplex.com)\r\n\r\n### Defining the Model\r\n\r\n\t[MongoKey(KeyFields = \"Code\")]\r\n\tpublic class Country: MongoMapper\r\n\t{ \r\n\t\t[MongoDownRelation(ObjectName = \"Person\", FieldName = \"Country\")]\r\n\t\tpublic string Code { get; set; }\r\n\t\tpublic string Name { get; set; }\r\n\r\n\t\t[MongoPropertyValidator(PropertyName=\"Code\")]\r\n\t\tpublic void CodeIsUp(string CountryCode)\r\n\t\t{\r\n\t\t\tif (CountryCode != CountryCode.ToUpper())\r\n\t\t\t\tthrow new Exception(String.Format(\"{0} must be {1}\", CountryCode, CountryCode.ToUpper()));\r\n\t\t}\r\n\t}\r\n\r\n\t[MongoKey(KeyFields = \"\")]\r\n\t[MongoIndex(IndexFields = \"ID,Country\")]\r\n\t[MongoIndex(IndexFields = \"Name\")]\r\n\t[MongoMapperIdIncrementable(IncremenalId = true, ChildsIncremenalId = true)]\r\n\tpublic class Person : MongoMapper\r\n\t{ \r\n\t\tpublic Person()\r\n\t\t{\r\n\t\t\tChilds = new List<Child>();\r\n\t\t}\r\n\t\t\t\t\r\n\t\tpublic string Name { get; set; }\r\n\t\tpublic int Age { get; set; }\r\n\t\tpublic DateTime BirthDate { get; set; }\r\n\t\tpublic bool Married { get; set; }\r\n\t\tpublic decimal BankBalance { get; set; }\r\n\t\t\r\n\t\t[MongoUpRelation(ObjectName = \"Country\", FieldName = \"Code\")]\r\n\t\tpublic string Country { get; set; }\r\n\t\t\t \r\n\t\t[MongoChildCollection]\r\n\t\tpublic List<Child> Childs { get; set;}\r\n\t}\r\n\t\r\n### Work with the Model\r\n\r\n\t\tCountry c = new Country {Code = \"es\", Name = \"España\"};\r\n\t\ttry\r\n\t\t{\r\n\t\t\tc.Save();\r\n\t\t}\r\n\t\tcatch(Exception ex)\r\n\t\t{\r\n\t\t\tAssert.AreEqual(ex.GetBaseException().GetType(), typeof(ValidatePropertyException)); \r\n\t\t\tc.Code = \"ES\";\r\n\t\t\tc.Save();\r\n\t\t}\r\n\t\t\r\n\t\tc = new Country { Code = \"UK\", Name = \"Reino Unido\" };\r\n\t\tc.Save();\r\n\t\t\r\n\t\tc = new Country { Code = \"UK\", Name = \"Reino Unido\" };\r\n\t\ttry\r\n\t\t{\r\n\t\t\tc.Save();\r\n\t\t}\r\n\t\tcatch (Exception ex)\r\n\t\t{\r\n\t\t\tAssert.AreEqual(ex.GetBaseException().GetType(),typeof(DuplicateKeyException));\t\r\n\t\t}\r\n\t\t\r\n\t\tCountry c2 = new Country { Code = \"US\", Name = \"Francia\" };\r\n c2.OnBeforeInsert += (s, e) => { ((Country)s).Name = \"Estados Unidos\"; }; \r\n c2.Save();\r\n\r\n Country c3 = new Country();\r\n\t\tc3.FillByKey(\"US\");\r\n Assert.AreEqual(c3.Name, \"Estados Unidos\");\r\n\t\t\r\n\t\tList<Country> countries = new List<Country>();\r\n\t\tcountries.MongoFind();\r\n\t\tAssert.AreEqual(countries.Count, 3);\r\n\r\n\t\tcountries.MongoFind(Query.Or(MongoQuery.Eq((Country co) => co.Code, \"ES\"), MongoQuery.Eq((Country co) => co.Code, \"UK\")));\r\n\t\tAssert.AreEqual(countries.Count, 2);\r\n\t\t\r\n\t\tPerson p = new Person\r\n\t\t{\r\n\t\t\tName = \"Pepito Perez\",\r\n\t\t\tAge = 35,\r\n\t\t\tBirthDate = DateTime.Now.AddDays(57).AddYears(-35),\r\n\t\t\tMarried = true,\r\n\t\t\tCountry = \"XXXXX\",\r\n\t\t\tBankBalance = decimal.Parse(\"3500,00\")\r\n\t\t};\r\n\r\n\t\tp.Childs.Add(new Child() { ID = 1, Age = 10, BirthDate = DateTime.Now.AddDays(57).AddYears(-10), Name = \"Juan Perez\" });\t\t\r\n\r\n\t\ttry\r\n {\r\n p.Save();\r\n }\r\n catch (Exception ex)\r\n {\r\n\t\t\tAssert.AreEqual(ex.GetBaseException().GetType(), typeof(ValidateUpRelationException));\r\n p.Country = \"ES\";\r\n p.Save();\r\n }\t\r\n\r\n\t\tp.ServerUpdate(Update.PushWrapped(\"Childs\", new Child() { ID = 2, Age = 2, BirthDate = DateTime.Now.AddDays(57).AddYears(-7), Name = \"Ana Perez\" }));\t\t\r\n\t\t\r\n\t\tList<Person> persons = new List<Person>();\r\n\t\tpersons.MongoFind(\"Childs.Age\",2);\r\n\t\tAssert.AreEqual(persons.Count, 1);\r\n\r\n\r\n### You can find examples in the Test Project \r\n\r\n* [Class Definition](https://github.com/emiliotorrens/MongoMapper.NET/tree/master/EtoolTech.MongoDB.Mapper.Test.NUnit/Classes) \r\n* [Find] (https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/FindTest.cs)\r\n* [Write] (https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/InsertModifyDeleteTest.cs)\r\n* [Incremental ID] (https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/IncrementalIdTest.cs)\r\n* [Relations](https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/RelationsTest.cs) \r\n* [Events] (https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/EventsTest.cs)\r\n* [Extension Methods] (https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/ExtensionTest.cs)\r\n* [Original Version] (https://github.com/emiliotorrens/MongoMapper.NET/blob/master/EtoolTech.MongoDB.Mapper.Test.NUnit/OriginalObjectTest.cs)\r\n \r\n### Change Log\r\n\r\n* [30/12/2011] (http://bit.ly/uy80RE)\r\n* [05/01/2012] (http://bit.ly/yfcsn4)\r\n* [02/02/2012] (http://bit.ly/AfGfKC)\r\n* [14/02/2012] (http://bit.ly/zvnk0F)\r\n* [07/03/2012] (http://bit.ly/wMX6Ha)\r\n* [20/03/2012] (http://bit.ly/GAIbez)\r\n \r\n\r\n","tagline":"A .NET Object Mapper for MongoDB over MongoDB C# Driver","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
@@ -0,0 +1,60 @@
+.highlight .hll { background-color: #49483e }
+.highlight { background: #3A3C42; color: #f8f8f2 }
+.highlight .c { color: #75715e } /* Comment */
+.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
+.highlight .k { color: #66d9ef } /* Keyword */
+.highlight .l { color: #ae81ff } /* Literal */
+.highlight .n { color: #f8f8f2 } /* Name */
+.highlight .o { color: #f92672 } /* Operator */
+.highlight .p { color: #f8f8f2 } /* Punctuation */
+.highlight .cm { color: #75715e } /* Comment.Multiline */
+.highlight .cp { color: #75715e } /* Comment.Preproc */
+.highlight .c1 { color: #75715e } /* Comment.Single */
+.highlight .cs { color: #75715e } /* Comment.Special */
+.highlight .ge { font-style: italic } /* Generic.Emph */
+.highlight .gs { font-weight: bold } /* Generic.Strong */
+.highlight .kc { color: #66d9ef } /* Keyword.Constant */
+.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
+.highlight .kn { color: #f92672 } /* Keyword.Namespace */
+.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
+.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
+.highlight .kt { color: #66d9ef } /* Keyword.Type */
+.highlight .ld { color: #e6db74 } /* Literal.Date */
+.highlight .m { color: #ae81ff } /* Literal.Number */
+.highlight .s { color: #e6db74 } /* Literal.String */
+.highlight .na { color: #a6e22e } /* Name.Attribute */
+.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
+.highlight .nc { color: #a6e22e } /* Name.Class */
+.highlight .no { color: #66d9ef } /* Name.Constant */
+.highlight .nd { color: #a6e22e } /* Name.Decorator */
+.highlight .ni { color: #f8f8f2 } /* Name.Entity */
+.highlight .ne { color: #a6e22e } /* Name.Exception */
+.highlight .nf { color: #a6e22e } /* Name.Function */
+.highlight .nl { color: #f8f8f2 } /* Name.Label */
+.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
+.highlight .nx { color: #a6e22e } /* Name.Other */
+.highlight .py { color: #f8f8f2 } /* Name.Property */
+.highlight .nt { color: #f92672 } /* Name.Tag */
+.highlight .nv { color: #f8f8f2 } /* Name.Variable */
+.highlight .ow { color: #f92672 } /* Operator.Word */
+.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
+.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
+.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
+.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
+.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
+.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
+.highlight .sc { color: #e6db74 } /* Literal.String.Char */
+.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
+.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
+.highlight .se { color: #ae81ff } /* Literal.String.Escape */
+.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
+.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
+.highlight .sx { color: #e6db74 } /* Literal.String.Other */
+.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
+.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
+.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
+.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
+.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
+.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
+.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
Oops, something went wrong.

0 comments on commit 611f8aa

Please sign in to comment.