I followed the instructions in the book to download pubs and Northwind databases, although I was sure I already had Northwind installed. The key step was to run the installation scripts from a VS08 command prompt.
sqlcmd -S .\SQLEXPRESS -i installpubs.sql
sqlcmd -S .\SQLEXPRESS -i installnwnd.sql
After returning to the Server Explorer, I still did not have any data connections, so I added one. I used SQL Server as the connection type; I chose SQLEXPRESS as the server; I chose the pubs database. Now I have a connection.
I used the visual designer for the .dbml file and dragged two tables onto it. After saving, the designer file had created a class with declared properties for accessing the tables.
I had to start again: at first, I selected new project, instead of new web site. Much better as a web site, I am now seeing all the prompts that I am supposed to see. After I understand this better, I will need to analyze the difference between a project and a web site.
I was able to access the table from ASP. I see that LINQ can create classes based on tables, but can it create tables based on classes? I have not seen any information on this. The other problem I have is that a lot of code is written in the ASP and not in a separate controller for the business logic.
I will look into using Hibernate with .NET. I will also look into moving all the business logic into one code-behind file and put all the validation in the data class.
No comments:
Post a Comment