T4 code to generate the ServiceConext

Oct 19, 2013 at 8:18 PM
Here is the T4 code to generate the ServiceContext and related sets;
    public partial class XrmServiceContext : Microsoft.Xrm.Sdk.Client.OrganizationServiceContext
    {
        public XrmServiceContext(Microsoft.Xrm.Sdk.IOrganizationService service) : 
                base(service)
        {
        }

<# foreach (var entity in Context.Entities){#>
        public System.Linq.IQueryable<<#=entity.DisplayName#>> <#=entity.DisplayName#>Set
        {
            get
            {
                return this.CreateQuery<<#=entity.DisplayName#>>();
            }
        }
<#}#> 
    }