locked
generate entities wrapper RRS feed

  • Question

  • I've just recreated my CRM development environment on a new computer. Now when I generate the Entities.cs file using the developers toolkit the file generates without any reference to XrmContext. So now my workflows won't compile as they use XrmContext which used to be generated in the Entities.cs file... what have I done?

    CRM 2011 RU 13

    Using Visual Studio 2010 - tried in Visual studio 2012 - same result


    Now using OrganizationServiceContext (this works - but now I have to remember how to spell the fields correctly...)


    which means I have to do this:

                using (var xrmContext = new OrganizationServiceContext(service))

                  {                              
                    var previousSet = 
                            (from x in xrmContext.CreateQuery("mu_myentity") 
                             where 
                                (String)x["mu_StudentID"]  == studentId
                                && (Boolean)(x["mu_SpecialCertificateUsed"]) == true 
                                && (Boolean)(x["mu_IsIncluded"]) == true 
                                && (DateTime)(x["CreatedOn"]) <  createdOn select x);

                    int recordCount = previousSet.ToList().Count();
                    return recordCount > 0;
                  } 

    instead of this (which removes some of the niceness of Early Binding)

                 using (var xrmContext = new XrmContext(service))
                  {                              
                    var previousSet = (from x in xrmContext.my_entity where x.mu_StudentID  == studentId && x.mu_SpecialCertificateUsed == true &&                         x.mu_IsIncluded == true && x.CreatedOn <  createdOn select x);
                    int recordCount = previousSet.ToList().Count();
                    return recordCount > 0;
                  }


    • Edited by Phil98765 Tuesday, July 22, 2014 11:17 PM update
    Tuesday, July 22, 2014 2:28 AM