{"id":3991,"date":"2014-03-30T06:59:56","date_gmt":"2014-03-30T06:59:56","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/problem-about-petapoco-collection-of-common-programming-errors\/"},"modified":"2014-03-30T06:59:56","modified_gmt":"2014-03-30T06:59:56","slug":"problem-about-petapoco-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/problem-about-petapoco-collection-of-common-programming-errors\/","title":{"rendered":"problem about petapoco-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7600c930e35f3db46f76f035bdb3e2d4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nTroy Alford<br \/>\nc# .net c#-4.0 .net-4.0 petapoco<br \/>\nI am using PetaPoco Micro-ORM with C# 4.0.The code below retrieves a single row from the database:var result = db.SingleOrDefault&lt;TdUsers&gt;(getUserQuery);I would like to check whether or not the result contains any rows, and whether is null. What is the best way to do this?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c661493e1a70ddca654691288baf9304?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nlearning<br \/>\npetapoco<br \/>\nI am having a project in which I have my API classes and in that project I have generated the Database.cs. In my MVC project I have refenrenced the API. Uppon running the application I am having the error message as follows, can anyone help please as I can`t understand why I am having this error message. From http:\/\/www.garethelms.org\/2011\/05\/help-getting-started-with-petapoco\/#comment-69, I can see that all the GetSetMethod() are GetSetMethod(true) ever since the petaPOCo is installed.Value<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/wXdgi.png?s=32&amp;g=1\" \/><br \/>\nOllie P<br \/>\nc# asp.net-mvc-4 petapoco npoco<br \/>\nI am using NPoco for object mapping from my database. I have the following entities:public abstract class NamedEntity {public int Id { get; set; }public string Name { get; set; } }public class Person : NamedEntity {public Office Office { get; set; } }public class Office : NamedEntity {public Address Address { get; set; }public Organisation ParentOrganisation { get; set; } }public class Address {public string AddressLine1 { get; set; } }public class Organisation : NamedEntity { }and I am retrievi<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8d266173b653b6aba4024335e1f704fd?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nIdan Shechter<br \/>\nasp.net petapoco<br \/>\nI am running PetaPoco template T4 on my database and it generates the following error:Running transformation: System.InvalidOperationException: Sequence contains more than one matching elementReported from the file &#8216;database.ttMy database is modeled correctly, however most of the tables have no records, although I tihnk that it&#8217;s nothing to do with it, is it?I&#8217;m querying a MySQL local database. I&#8217;ve setup the connection string in the web.config and this is the only connection string in the w<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Troy Alford c# .net c#-4.0 .net-4.0 petapoco I am using PetaPoco Micro-ORM with C# 4.0.The code below retrieves a single row from the database:var result = db.SingleOrDefault&lt;TdUsers&gt;(getUserQuery);I would like to check whether or not the result contains any rows, and whether is null. What is the best way to do this? learning petapoco I am [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3991","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3991","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3991"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3991\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3991"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}