如何动态地根据表引用和字段名从数据库中获取标签的英文文本 [英] How to get english text of label from database based on table reference and field name as dynamically

查看:116
本文介绍了如何动态地根据表引用和字段名从数据库中获取标签的英文文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何根据表格参考和字段名称从数据库中获取标签的英文文本为动态...



我在SQL server 2012 asp.net中创建项目核心2.1 visualstudio2017和技术我使用实体框架核心2.1来支付b $ b。



我需要的是获得来自数据库的标签控制文本基于表名和



参考表中的字段名称。



so我需要使用函数来获取表格字段时的标签文本



根据表格和字段名称匹配参考文件中存在的内容。



这样做怎么做?



来解释我需要的东西看看这个例子



假设我有物品表和产品表



物品表有两个字段

物品代码< br $>
产品名称

产品表有两个字段

产品编号

产品名称

参考表有5个字段



How to get English text of label from database based on table reference and field name as dynamic...

I make project in SQL server 2012 asp.net core 2.1 visualstudio2017 and technology i

using entity framework core 2.1 .

what I need is to get text of label control from database based on table name and

field name from reference table .

so that i need to make function can be used to get the label text when table fields

match what exist on reference file based on table and field name .

so that How to do that ?

to more explain what i need see this example

suppose i have item table and product table

Item table have two fields
Item Code
Item Name
Product table have two fields
Product No
Product Name
reference table have 5 fields

serial tablename fieldname   ArabictextforLabel EnglishtextforLabel 
1        Item      ItemCode         كود الصنف              ItemCodeVal
2        Item      ItemName         اسم الصنف              ItemNameVal        
3        Product   ProductNo        كود المنتج              ProductNoVal
4        Product   ProductName      اسم المنتج              ProductNameVal





这样当去查看项目



为项目的视图模型获取labeles的文本(ItemCodeval然后显示itemnameval)



和产品视图上的相同内容显示标签文字为(productnoval和



productnameval)视图模型产品



当这篇文章为亲管道表和项目表已更改,这将在视图中动态更改。



这将使每个标签动态显示文本



这可以在asp.net核心2.1实体框架核心2.1上使用吗?如果允许的话怎么做?



我试过的:





so that when go to view Items

get text for labeles as (ItemCodeval then display itemnameval) for viewmodels for items

and same thing on product view display label text as ( productnoval and

productnameval) for view model Products

and when this text for product table and items table changed this will changed on view as dynamically .

this will make dynamically show text per labels

Can this available on asp.net core 2.1 entity framework core 2.1 or not and how to do it if allowed ?

What I have tried:

How to get English text of label from database based on table reference and field name as dynamically

推荐答案

你的英语和我不一样。

尝试下面的内容:

绑定你的标签通过在dbcontext的类继承中定义dbset来实现该字段。(实体解决方案)
your English is not good same as me.
try below:
bind your label to that field by defining dbset in a class inheritance from dbcontext.(entity solution)


这篇关于如何动态地根据表引用和字段名从数据库中获取标签的英文文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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