c#,SQL Server问题 [英] c#,SQL Server Question

查看:96
本文介绍了c#,SQL Server问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hey Guys,



我有一个父类Fruit和两个嵌套的类,如Apple和Orange。这种关系称为继承。但任何人都可以告诉我是否我想在数据库中设计表结构。调用该关系是什么以及如何设计/关联该模式中的表?





先谢谢。

Hey Guys,

I have a parent class Fruits and two nested classes like Apple and Orange.This relationship is called inheritance.but can anyone plz tell me if i want to design table structure in the database.what would be that relationship called and how can i design/relate tables from that schema ?


Thanks in Advance.

推荐答案

阅读这些内容,希望他们能提出一些想法:

1. c-oop-abstract-classes-fruit [ ^ ]

2. 如何有效地模型继承-in-a-database [ ^ ]
Read these, hopefully they can give your some ideas:
1. c-oop-abstract-classes-fruit[^]
2. how-do-you-effectively-model-inheritance-in-a-database[^]


嵌套与继承完全无关。要使用继承,您应该从 Fruit Apple Orange >。 (我将基类名称更改为单数;您对复数的使用是基于您对继承以及类和实例的非常重要的混淆。)



当然,这是早期与您讨论数据库的方法。你还没准备好。到目前为止,你还不知道OOP是如何工作的,并且在你掌握任何高级技术之前需要学习它(而且,我确定,有很多基本的东西)。



-SA
Nested is totally irrelevant to inheritance. To use inheritance, you should derive Apple an Orange from Fruit. (I changed base class name to singular; your use of plural is based on you deep confusion about inheritance and the very role of classes and instances.)

And of course, it's way to early to discuss databases with you. You are just not ready. So far, you have no clue on how OOP works and need to learn it (and, I'm sure, very many basics things) before you get to anything advanced.

—SA


你可以提供更多你的问题的详细信息。您可以使用主键获取表T_FRUIT,并将主键作为外键提供给T_APPLE和T_ORANGE。



T_FRUIT

FruitsId < br $>
FruitsName

FruitsSize



T_APPLE

AppleId

FruitsId

AppleColor



T_ORANGE

OrangeId

FruitsId

OrangeColor
YOu could give more details for your problem. You can take a table T_FRUIT with a primary key and give the primary key to T_APPLE and T_ORANGE as foreign key.

T_FRUIT
FruitsId
FruitsName
FruitsSize

T_APPLE
AppleId
FruitsId
AppleColor

T_ORANGE
OrangeId
FruitsId
OrangeColor


这篇关于c#,SQL Server问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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