5 Replies - 1805 Views - Last Post: 04 September 2013 - 02:45 PM Rate Topic: -----

#1 ngroebner  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 42
  • Joined: 18-March 13

Ado.Net EF with SQL program design help

Posted 30 August 2013 - 01:46 AM

Hello,

I am fairly new to programming, and I have recently been challenged with a software project that I am finding myself a bit stumped on. I have a rather large relational database stored in Microsoft SQL Server. I am using Visual Studio 2010, C# (which I have little experience with), and entity framework (first time using). Essentially this is a Web Form application that takes an identifier from the user, and on submit needs to pull one record from about twenty different tables which makes up this persons data record.

I am new to entity framework, as well as even how to perform sql queries through .NET framework in c#

The identifier, lets call it UBI# isnt even in all of the tables, however they do all share relationship to each other through another primary key lets call it AppId.

I am having trouble getting the ball rollnig on the design for this or where to start. I have my GUI up and running, I have installed and connected to the database using Entity Framework which has created my model, but I just now dont really know where to go with it.

There is about twenty tables all having some relationship back to this RENEWAL table which contains the UBI#. Although this is one of the only tables that has the UBI, all of the tables have the AppID. how can I get all of these datasets?

I am just looking for a bit of design theory or psuedo code ideas as to the direction to go.

A little more background....once I have these records, the main use is to simply move them over to another database that is in essence exactly the same. This is just a tool to use to sync up a developer database and a test database one record at a time as needed. I think that once I understand the concept of really how to dig these records out of the database in the first place, I will be able to put them back. This is essentially some select, delete, and update, statements that I am unsure how to put into .NET and in which order.

Like i said before I am fairly new, and although I have had some experience, the amounts of data in this work database, as well as the number of tables is just larger than any project I have dealt with as a computer science student.

Is This A Good Question/Topic? 0
  • +

Replies To: Ado.Net EF with SQL program design help

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3549
  • View blog
  • Posts: 10,989
  • Joined: 05-May 12

Re: Ado.Net EF with SQL program design help

Posted 30 August 2013 - 05:58 AM

*sigh* As a computer science student you should have learned early on that you plan your objects and data first, and do your UI second. You obviously missed that unwritten lessons based on:

Quote

I am having trouble getting the ball rollnig on the design for this or where to start. I have my GUI up and running, I have installed and connected to the database using Entity Framework which has created my model, but I just now dont really know where to go with it.


Fortunately your you, there is a way out. Use the "Reverse Engineer" feature that comes with the EF. See step 2 here:
http://msdn.microsof...a/jj200620.aspx
Was This Post Helpful? 1
  • +
  • -

#3 DarenR  Icon User is offline

  • D.I.C Lover

Reputation: 447
  • View blog
  • Posts: 3,095
  • Joined: 12-January 10

Re: Ado.Net EF with SQL program design help

Posted 30 August 2013 - 07:10 AM

View PostSkydiver, on 30 August 2013 - 08:58 AM, said:

*sigh* As a computer science student you should have learned early on that you plan your objects and data first, and do your UI second. You obviously missed that unwritten lessons based on:



i have to disagree--- everyone programs differently.

personally i like to see what my gui needs to look like with customer requirements before i code the back end because a lot of times what is easy for a software guy to understand isnt for a customer.
You should ALWAYS make your gui for that of a 5th grade or lower education level because let's face it when it comes down to it customers are dumb even when they are not.
Was This Post Helpful? 1
  • +
  • -

#4 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3549
  • View blog
  • Posts: 10,989
  • Joined: 05-May 12

Re: Ado.Net EF with SQL program design help

Posted 30 August 2013 - 06:44 PM

And even when designing to make stuff idiot proof, the universe somehow manages to make a better idiot. :)

Yes, I agree about seeing the UI ahead of time to envision what the experience might be like, but it's one thing to create a mockup of the UI, and another thing to:

Quote

I have my GUI up and running

Was This Post Helpful? 0
  • +
  • -

#5 DarenR  Icon User is offline

  • D.I.C Lover

Reputation: 447
  • View blog
  • Posts: 3,095
  • Joined: 12-January 10

Re: Ado.Net EF with SQL program design help

Posted 03 September 2013 - 05:18 AM

Skydiver I missed the part where he said it was up and running --- lol


i'd give you a + but those functions dont work at my job
Was This Post Helpful? 0
  • +
  • -

#6 ngroebner  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 42
  • Joined: 18-March 13

Re: Ado.Net EF with SQL program design help

Posted 04 September 2013 - 02:45 PM

So like i said, this is more of a noob design concepts discussion.

As I have it, I have a GUI that accepts input from a user. This input is a ten digit number that is an identifier in on of my MS SQL database tables.

I have a model built from a database using Entity Framework.

Through this model I have been able to grab the particular record that I need in this manner....

protected void btnLoad_Click(object sender, EventArgs e)
        {
               
            SOLAR2Entities SE = new SOLAR2Entities();//This creates a new instance of my model object


                 //This queries the database and returns my record to a list
                 //I am not sure that I even want a list, its just how I have found to do this.
            var renewalList = SE.buRenewals.ToList().Where(x => x.UBI == txtUBI.Text);

                 //as a verification, I displayed the new list in a gridview
                 //this was just a verification that the accurate record was pulled.
                 //my actual intentions do not need to display this to the user
                 //I actually want to take this record, and attempt to place it into an identical yet,
                 //different physical database  
                 GridView1.DataSource = renewalList;
                 GridView1.DataBind();
        }




I am not experienced in using SQL statements within c# so I used this method to query the data.

What my question is I guess, If I want to select query one record from one table from one model, and then insert that returned item into a different table in a different model, where do I go from here?

Is it right to make a list from this return? what is the best way to capture that record until I tranfer the information into an insert statement?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1