views:

238

answers:

1

Hi All, my first question here on Stackoverflow (wish me luck :))

So, I have a new site on my mind that I would like to create using as much "generation"-friendly stuff as possible due to the fact that I'm getting tired of coding the same stuff all over again.

This has made me take a peek at the SubSonic project (have been looking at the other stuff created by Rob as well) and I really like the concept. The only thing on my mind is the scenario where I have created my database-model using the ASP.NET "build-in" Membership provider.

The stuff I am currently facing is the fact that if I have, for example, a News table with an EditorID and a CreatorID column which are both a foreign key to the aspnet_Users table, this gets me in to kind of a trouble. The properties generated on my News class will be named aspnet_Users and aspnet_Users1

Is there some way of hijacking this process and having it make use of the foreign key name or something? I would like to have these properties called Editor and Creator of course.

Is this possible?

+1  A: 

My first thought is you don't want to do this (the FK to the membership table). While convenient - you're tying your design to another system which can be an issue.

What I might suggest is having an intermediary table - Users if you will - and leave the FK relationship off.

That said - yes you should be able to tweak the templates (assuming you're using 3.0) to accomodate your needs.

Rob Conery
I really never thought about it that way. But that will solve my case. Thanks Rob!
Jonas Cannehag
Damnit! I cannot understand how so use this stuff...Lets say i have a NewsArticle table and one news entry can exists on different sites (a site in this case i different sections on one website).I have for this purpose a Site table with some different sites.To connect the NewsArticles to the Sites i have a table called NewsArticleSite with the ID's from the different tables.This will in subsonic leave me with NewsArticle.IQueryable<NewsArticleSite>.IQueryable<Site>This is not really so easy to use?
Jonas Cannehag