如何在模型第一种方法中在另一种复杂类型中创建复杂类型的列表类型 [英] How to create the complex type of list type inside another complex type in model first approach

查看:77
本文介绍了如何在模型第一种方法中在另一种复杂类型中创建复杂类型的列表类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨每一个,



我在模型第一种方法中遇到问题,他们将是主要的复杂类型,其中包含姓名,地址,电子邮件,Phoneno是父类。我应该创建第二个复合体,它将是具有不同名称和第一个复杂类型列表的第一个复杂类型的子类。





班级员工

{

公共字符串名称{get; set;}

公共字符串地址{get; set;}

公共字符串电子邮件{get; set;}

公共字符串Phoneno {get; set;}



}



班级组织:员工

{

公共员工经理{get; set;}

公共列表< employee> Direct_Roles {get; set;}

}







我想要在模型浏览器中以上述格式创建复杂类型。

解决方案

您已将两个不同的概念合并为一个。继承和复杂类型。



1.你可以做这样的继承。

班级组织:员工
{
public 列表< employee> Direct_Roles { get ; set ;}
}
< / 员工 >





2.复杂类型声明如下

班级组织
{
< span class =code-keyword> public 员工经理{获取; 设置;}
public 列表< employee> Direct_Roles { get ; set ;}
}
< / 员工 >


Hi Every one,

I am struggling with an issue in model first approach, their will be main complex type which contains Name,Address,Email,Phoneno which is the parent class. And I should create second complex which will be child class having the first complex type with different name and list of first complex type.


Class Employee
{
public string Name{get;set;}
public string Address {get;set;}
public string Email{get;set;}
public string Phoneno {get;set;}

}

Class Organisation:Employee
{
public Employee Manager{get;set;}
public List<employee> Direct_Roles{get;set;}
}



I want to create a Complex type in the above format in model browser.

解决方案

You have merged two different concept into one. Inheritance and Complex type.

1. You can do something like this for inheritance.

Class Organisation:Employee
{
   public List<employee> Direct_Roles{get;set;}
}
</employee>



2. Complex type declaration as follows

Class Organisation
{
public Employee Manager{get;set;}
public List<employee> Direct_Roles{get;set;}
}
</employee>


这篇关于如何在模型第一种方法中在另一种复杂类型中创建复杂类型的列表类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆