仅选择列表名称ffrom table,Entity Framework [英] Select only columns name ffrom table, Entity Framework

查看:69
本文介绍了仅选择列表名称ffrom table,Entity Framework的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

你能给我一个小例子,用EntityFramework从表中选择列名吗?

解决方案

你根据您的需求提供多种可能性。请参阅以下内容:

a)在 INFORMATION_SCHEMA.COLUMNS 系统表上创建视图或存储过程,在EF模型中包含该视图或sp。

b)如果你想获得模型中已有实体的字段,只需使用反射。

c)但您也可以查询EF元数据,请查看: http:// www .scip.be / index.php?Page = ArticlesNET24 [ ^ ]

Hello everyone!
Can you get me a little example hoe to select only columns names from table with EntityFramework?

解决方案

You have several possibilities according to your needs. Please see following:
a) Create a view or stored procedure over INFORMATION_SCHEMA.COLUMNS system table, include that view or sp in your EF model.
b) If you want to get the fields of an entity already in the model, just use reflection.
c) But you can also query EF metadata too, check this: http://www.scip.be/index.php?Page=ArticlesNET24[^]


这篇关于仅选择列表名称ffrom table,Entity Framework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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