.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Imran Ghani
Post New Web Links

A simple Data Modeling Question

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :ASP.Net
 

I have a data modeling question that hopefully this fictious example will help explain.  My application is data driven and the classes reflect the tables to a large degree.   In this example my database has two tables:

  • VendorMaster with an int Primary Key of VendorID
  • VendorContact with an int Primary Key of ContactID

The VendorContact table also has a Foreign Key of VendorID in order to associate the contact with a specific Vendor.  In this example a Vendor can only have one contact.

My question is how to represent these two tables in terms of classes.  In my current design I have two classes:

  • VendorMaster
  • VendorContact

In order to represent the relationship between a VendorMaster and VendorContact, my VendorMaster class contains a property called VendorContact.

My questions are about the VendorContact class and how it represents the relationship between a VendorMaster and itself.

Option #1

The VendorContact class should contain an int property of VendorID

Option #2

The VendorContact class should contain a VendorMaster Property

I am not sure which option is the 'best' option to take. My concern is that if I go with option #2 that I would create a cyclical relationship between the VendorMaster and Vendo


View Complete Post


More Related Resource Links

Simple data binding question

  
Newbie binding question here: is it possible to bind a control in XAML to a StaticResource by passing in the key via a data structure? Basically something like this: <TextBlock Text="{Binding ImageKey}" /> <Image Source="{StaticResource ResourceKey={Binding ImageKey}}" /> <-- doesn't work   The TextBlock binding on the first line works correctly, it extracts the key of the StaticResource from my data structure and displays it correctly. What I'm trying to do is get the Image control to bind to the StaticResource with that name (which happens to be a BitmapImage).      

Surrogate vs Natural Primary Keys - Data Modeling Mistake 2 of 10

  
In case you're new to the series I've compiled a list of ten data modeling mistakes that I see over and over that I'm tackling one by one. I'll be speaking about these topics at the upcoming IASA conference in October, so I'm hoping to generate some discussion to at least confirm I have well founded arguments.

The last post in this series Referential Integrity was probably less controversial than this one. After all, who can argue against enforcing referential integrity? But as obvious as surrogate keys may be to some, there is a good deal of diversity of opinion as evidenced by the fact that people continue to not use them.

ADO.NET: Achieve Flexible Data Modeling with the Entity Framework

  

Here the author answers questions regarding the Entity Framework and provides an understanding of how and why it was developed.

Elisa Flasko

MSDN Magazine July 2008


XML in .NET: .NET Framework XML Classes and C# Offer Simple, Scalable Data Manipulation

  

Microsoft .NET introduces a new suite of XML APIs built on industry standards such as DOM, XPath, XSD, and XSLT. The .NET Framework XML classes also include innovations that offer convenience, better performance, and a more familiar programming model, tightly coupled with the new .NET data access APIs-ADO.NET. XmlWriter, XmlReader, and XmlNavigator classes and classes that derive from them, including XMLTextReader and XMLTextWriter, encapsulate a number of functionalities that previously had to be accomplished manually. A discussion of the XMLDOM-Document is also included.

Aaron Skonnard

MSDN Magazine January 2001


Entity framework simple question

  

Hi

 

First I am newbie using EF - so sorry on this basic question

 

I have a Project Table that relate to Company Table

 

When I Map with EF I Do not have property of CompanyId in the Project Object

But I have related Company Object

 

For example

Project p = new Project();

p.CompanyId è does not exist!

When I try addingit myself I get this error:

If I need just the Company id, and I don't want get it like

p.Company.CompanyId - because than the application try connect again to the DB and I don't want this, because I need just the CompanyId.

What the best regular way to get it?

Thanks


GridView Question - Please Help Me...Should Be Simple...

  
Hello,I have what I think should be a simple GridView question but I can't find the answer.When I want to update a row in Gridview I click on the "Edit" link.  It takes me into the row of the GridView where I can edit the values.Here's how it looks:   CustomerID CompanyName Edit 001 IBM Microsoft Apple Google Edit 002 IBM Microsoft Apple Google Edit 003 IBM Microsoft Apple Google Edit 004 IBM Microsoft Apple Google When I click on "Edit" it looks like:   CustomerID CompanyName Edit 001 IBM Microsoft Apple Google Update Cancel IBM Microsoft Apple Google Edit 003 IBM Microsoft Apple Google Edit 004 IBM Microsoft Apple Google As you can see, I now have the ability to update the CustomerID.  I don't the user to be able to update the CustomerID, only the CompanyName via the DropDown.How can I change the GridView to ONLY allow me to update the CompanyName?ThanksJason   CustomerID CompanyName Edit 001 IBM Microsoft Apple Google Edit 002 IBM Microsoft Apple Google Edit 003 IBM Microsoft Apple Google Edit 004 IBM Microsoft Apple Google

Data modeling and dimensional modeling

  
Hi Team, Can anyone tel me best book or source to learn data modeling and dimensional modeling? Thanks in advance! Regards, Eshwar    

Data Mining Solution Question

  
Hi, I am working for a company that would like to use Aanalysis Services for predictive analytics. My problem is that there are only 40 or so months worth of data. I am wondering if this is enough to even make anything relevant and/or accurate.   So far I've made a time series mining structure, that just uses the booking number as input and predict. I am having a hard time justifying this as they view it as something that could have just been done in excel.   Also I have made a neural network. The company has several (continuous) metrics that they track along with bookings. So I made a neural network to use these inputs to predict the bookings.   This made another problem. The prediction that the neural network makes is different from the next month that that time series predicts and is causing distrust by the potential end users.   I've thought about combining the two models. I could use the output of the neural net and do a natural prediction join of that result into the time series.   Seeking advice, and something that I can do with Analysis Services that could be useful to a company with only a small number of months of data to work with.   -S

SQL server 2008 r2 Data sync question???

  
Sql 2008 r2 data sync, does it involve a db hosted by microsoft or does that involve us hosting the sync functionality locally?  I know we have db's local that need to be sync'd across a wan but does that happen in a db hosted in the ms cloud or does that have to do with a sync functionality that runs locally to keep my db's sync'd?   Thanks, SL

Data Mining Solution Question

  
Hi, I am working for a company that would like to use Aanalysis Services for predictive analytics. My problem is that there are only 40 or so months worth of data. I am wondering if this is enough to even make anything relevant and/or accurate.   So far I've made a time series mining structure, that just uses the booking number as input and predict. I am having a hard time justifying this as they view it as something that could have just been done in excel.   Also I have made a neural network. The company has several (continuous) metrics that they track along with bookings. So I made a neural network to use these inputs to predict the bookings.   This made another problem. The prediction that the neural network makes is different from the next month that that time series predicts and is causing distrust by the potential end users.   I've thought about combining the two models. I could use the output of the neural net and do a natural prediction join of that result into the time series.   Seeking advice, and something that I can do with Analysis Services that could be useful to a company with only a small number of months of data to work with.   -S

Simple Question

  
hi i m using Resource file for localization everything cool I pick the date value and i format it then i set the HtmlTableCell InnerText value the date value shows in Thai format i don't want to show the date in thai language format how can i prevent this 

Question about quality of data

  
Hello, Thanks for the help on the last question.  We have looked at several open source offers in the field of data integration. We are now wanting data quality software to complete our data integration program.  Do packages exist to suit our needs? Would you know of innovative data quality programs? Thanks to all!

Simple Viewstate question

  
Consider a page with asp textbox and a button. textbox's "EnableViewstate" property is set as "False". In page directive also i set the Page's "EnableViewstate" property as "False". If i type some text (i.e., like "This is sample text") on the text box and click the command button. After the postback also that text box contains the same text ("This is sample text") which i have typed. I have set the view state in page for false. Then how the state is maintained?  whats the reason behind that? Thank you.

Simple Question

  
 Hi Guys,    I had a webservice method, Whenever it throws an Exception Object, I justwant to catch that Exception Object from the AJAX function. Is it possible? If so, please give sample code snippet ASAP.  Thanks in advance.

Simple question.... LINQ on Datatable

  
Hi all,Simple one this I am sure for those who use LINQ! :)I basically have two tables that will be stored in viewstate until I save the data to the database.  I need a way to query the datatables, delete remove etc.  Is this possible in LINQ?So for example, delete/select rows from the DataTable that have a particular ID etc...Thanks,Mark

Help - simple data binding

  
As a newbie I am struggling with the data binding syntax. In the code below I have used a class to create a simple data structure. (I need to be able to fill this from an array which I can do.) For this example I have filled it in directly. However, despite exhaustive searching in the web I cannot find a Visual Basic example showing me how to bind this data source to a Datagrid. I have included in the code the xaml for a basic data grid. Can anynbe help me with the xaml to bind the fields to textboxes? Class MainWindow Public test As String ' Public mage() As Integer = {24, 35, 46, 57} Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded Dim P1 As New myPerson(111, "Bob", 23) Dim P2 As New myPerson(222, "Fred", 34) Dim P3 As New myPerson(333, "Bill", 17) Dim P4 As New myPerson(121, "Alf", 44) Dim st As New SortedList st.Add(P1.name, P1) st.Add(P2.name, P2) st.Add(P3.name, P3) st.Add(P4.name, P4) Dim P As myPerson Dim i As Integer For i = 0 To st.Count - 1 P = CType(st.GetByIndex(i), myPerson) Console.WriteLine("The age of " & P.name & " is " & P.age) Next End Sub End Class Public Class myPerson Public id As Integer Public name As String Public age As In

Simple Data Extension

  
Hi I have a requirement to apply security filtering (column and row level) above and beyond the capabilities of SSRS Model security. in 2005 and 2008 I achieved this by creating a data Extension and tweaking the Command text and execute reader methods, and all was Well with the world. Now all I wanted was a bit of customisation of the SQL data Extension  (SQL Connection Wrapper)... of course its Sealed so couldn't inherit, so I composite / wrapped it... and all was well with the world......  Now along comes SQL2008 R2 .... and someone has discovered the internal Keyword !  now everything is locked down.  the Constructor of SQL Connection Wrapper  is internal. Luckily my code is not yet producion code, and I know Microsoft are completely within their rights ... but why!!! ... all is not good with the world, I doubt I am alone in this ! Any suggestions how to implement a minor customisation to SQL data Extension, without reimplementing the whole of the dataExtensions DLL ! Any chance the decison might be reversed ?  regards Iain   
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend