Website:
The Web Site project is compiled on the fly. You end up with a lot more DLL files, which can be a pain. It also gives problems when you have pages or controls in one directory that need to reference pages and controls in another directory since the other directory may not be compiled into the code yet. Another problem can be in publishing.
If Visual Studio isn't told to re-use the same names constantly, it will come up with new names for the DLL files generated by pages all the time. That can lead to having several close copies of DLL files containing the same class name,
which will generate plenty of errors. The Web Site project was introduced with Visual Studio 2005, but it has turned out not to be popular.
Web Application:
The Web Application Project was created as an add-in and now exists as part
of SP 1 for Visual Studio 2005. The main differences are the Web Application Project
was designed to work similarly to the Web projects that shipped with Visual Studio 2003. It will compile the application into a single DLL file at build
time. To update the project, it must be recompiled and the DLL file
published for changes to occur.
Another nice feature of the Web Application
project is it's much easier to exclude files from the project view. In the
Web Site project, each file that you exclude is renamed with an excluded
keyword in the filename. In the Web Application Project, the project just
keeps track of which files to include/exclude from the project view without
renaming them, making things much tidier.
Reference
The article ASP.NET 2.0 - Web Site vs Web Application project also gives reasons on why to use one and not the other. Here is an excerpt of it:
- You need to migrate large Visual Studio .NET 2003 applications to VS
2005? use the Web Application project.
- You want to open and edit any directory as a Web project without
creating a project file? use Web Site
project.
- You need to add pre-build and post-build steps during compilation?
use Web Application project.
- You need to build a Web application using multiple Web
projects? use the Web Application project.
- You want to generate one assembly for each page? use the Web Site project.
- You prefer dynamic compilation and working on pages without building
entire site on each page view? use Web
Site project.
- You prefer single-page code model to code-behind model? use Web Site
project.
Web Application Projects versus Web Site Projects (MSDN) explains the differences between the web site and web application projects. Also, it discusses the configuration to be made in Visual Studio.
First and foremost: the t4 templates are there for you to change as needed with SS3. That was the main idea with using T4 - I don't want to back you into my silliness :).
To the question at hand - I think this might be a bug in our templates that refuses to stick a value into the PK field:
ISqlQuery BuildInsertQuery(T item) {
ITable tbl = _db.FindTable(typeof(T).Name);
Insert query = null;
if (tbl != null) {
var hashed = item.ToDictionary();
query = new Insert(_db.Provider).Into<T>(tbl); ;
foreach (string key in hashed.Keys) {
IColumn col = tbl.GetColumn(key);
if (!col.IsPrimaryKey) {
query.Value(key, hashed[key]);
}
}
}
return query;
}
In this, our check should actually be...
if (!col.IsPrimaryKey && !col.AutoIncrement) {
query.Value(key, hashed[key]);
}
In this way, the non-identity will be inserted. But in reading your issue here, it sounds to me like you're not trying to insert into a non-identity.
The email you sent me doesn't say anything about PKs as identity - your PK was a thing called "NAme" which is a string type and not and identity (auto-increment).
I'm wondering about when I cannot get around this issue--when I have to add a new record to the database and have an identity as my primary key.
This is what SubSonic assumes - that your PK is an IDENTITY column. If you ONLY have an IDENTITY column, we can't help you because this is a deadlocked table in that you can't insert any value into it, therefor you can't tick the IDENTITY column. Your only recourse at this point is to SET IDENTITY INSERT="off", which defeats the purpose.
Hopefully this will answer your question? If I'm not getting it - can you do this for me:
- One sentence: what can't you do and what's the error
- What did you expect
Thanks Will and I hope I'm not being thick.
Best Answer
Sure - have a peak: http://blog.wekeroad.com/subsonic/subsonic-writing-decoupled-testable-code-with-subsonic-2-1/