小编Jas*_*wer的帖子

DbDomainService <T>不生成代理实体

我已经在几台机器上的visual studio 2010和11 beta上试过这个.我还使用了EF 4.3和5.0 - beta 2.我正在尝试Silverlight 5中的代码优先方法.

我创建了一个DbDomainService并为它创建了CRUD操作,但在客户端没有创建任何代理实体.我在WCF类库中执行此操作.以下是它的创建方法:我将一个项目添加到解决方案(WCF RIA Services类库).客户端和服务端项目会自动添加并通过RIA链接进行链接.我创建了我的实体和dbcontext(参见下面的源代码).我创建了我的域服务类(向导只显示了一半的时间,非常错误)并确保有CRUD操作.我重建,并在客户端项目上显示所有文件,并且没有生成代码.如果我将DomianService类更改为继承自DomainService而不是DbDomainService,那么我的代理实体将按照预期在客户端生成.

构建解决方案时,我收到以下警告:

警告1创建MEF组合容器时发生以下异常:无法加载一个或多个请求的类型.检索LoaderExceptions属性以获取更多信息.将使用默认代码生成器.AProgram.Client.RIAServices

请帮忙 :)

    namespace AProgram.Server.RIAServices.Models.Sales
    {

       public class Customer
       {
          [Key]
          public int CustomerID { get; set; }

          [Required]
          [MaxLength(50)]
          public string CustomerName { get; set; }
       }

    }

    namespace AProgram.Server.RIAServices
    {
       public class SalesDbContext : DbContext
       {
          public DbSet<Customer> Customers { get; set; }
       }
    }

    namespace AProgram.Server.RIAServices
    {
       using System;
       using System.Collections.Generic;
       using System.ComponentModel;
       using System.ComponentModel.DataAnnotations;
   using System.Linq;
   using System.ServiceModel.DomainServices.Hosting;
   using System.ServiceModel.DomainServices.Server;


   // TODO: Create …
Run Code Online (Sandbox Code Playgroud)

wcf ria entity-framework code-first ef-code-first

1
推荐指数
1
解决办法
1086
查看次数

标签 统计

code-first ×1

ef-code-first ×1

entity-framework ×1

ria ×1

wcf ×1