PDA

View Full Version : چگونگی استفاده از کاردینالیتی های فاز تحلیل در پیاده سازی



resident
شنبه 29 دی 1386, 21:03 عصر
سلام.
بچه ها اینهمه کاردینالیتی که در فاز تحلیل در میاریم در پیاده سازی کجا ازشون استفاده می کنیم؟
مثلا اگه یکی از کاردینالیتی های یک رابطه 2 باشه ، ما در پیاده سازی واقعا چک می کنیم که یک نمونه از این کلاس ما با 2 نمونه از اون یکی کلاس رابطه داشته باشه؟ یا موارد دیگه؟اگه این چنین مواردی هست لطف می کنید بگید؟ متشکرم

sinpin
یک شنبه 30 دی 1386, 01:48 صبح
بچه ها اینهمه کاردینالیتی که در فاز تحلیل در میاریم در پیاده سازی کجا ازشون استفاده می کنیم؟
در طراحی روابط بین جداول دیتابیس (و یا پیاده سازی روابط بین کلاسها)


Cardinality helps us further understand the nature of the relationship between the child entity and the parent entity. The cardinality of a relationship may be determined by asking the following question: "How many instances of the child entity relate to each instance of the parent entity?". There are four types of cardinality: (1.) One to zero or more (common cardinality), (2.) One to one or more (P cardinality), (3.) One to zero or one (Z cardinality), and (4.) One to exactly N (N cardinality).بنقل از : http://www.sqlteam.com/article/database-design-and-modeling-fundamentals (http://www.sqlteam.com/article/database-design-and-modeling-fundamentals)


A relational database contains multiple tables, each similar to the one in the "flat" database model. One of the strengths of the relational model is that, in principle, any value occurring in two different records (belonging to the same table or to different tables), implies a relationship among those two records. Yet, in order to enforce explicit integrity constraints, relationships between records in tables can also be defined explicitly, by identifying or non-identifying parent-child relationships characterized by assigning cardinality (1:1, (0) 1:M, M:M). Tables can also have a designated single attribute or a set of attributes that can act as a "key", which can be used to uniquely identify each tuple in the table.بنقل از : http://en.wikipedia.org/wiki/Database (http://en.wikipedia.org/wiki/Database)

resident
یک شنبه 30 دی 1386, 08:09 صبح
sinpin جان با نکاتی که شما اشاره کردید مشکلی ندارم. منتها مثلا در پیاده سازی با زبان سی شارپ نمیدونم این کاردینالیتی ها کجا به کار میرن. چون تا اونجایی که بنده میدونم هر جا رابطه ای بین دو کلاس( از هر نوع کاردینالیتی) باشه ، ما فقط یک آبجکت از اون کلاسی که کاردینالیتی اش غیر از 1 است در اون کلاسی که کاردینالیتی اش 1 است، new می کنیم. بعد از درآوردن کلی کاردینالیتی های مختلف تو سی شارپ فقط یک آبجکت new می کنیم؟!!!