Question

I'm experiencing a problem while working with all my projects. I don't get Intellisense with Linq2Sql and, when I write partial classes in the model folder, properties created by the Linq2Sql designer are not recognized by the partial classes. So, I'm trying to rule out all the possible sources of the problem.

I have 2 cases: (i) create a .mdf file under App_Data and (2) create a .dbo file in SQL EXPRESS 2005. Now, when I create the DataContext file (by dragging and dropping tables in the designer), are there going to work the same way? Or do I need to expect unanticipated behavior?

Thanks

Was it helpful?

Solution

App_Data is only used in ASP.NET apps and is only meant to store the physical database file (the ASP.NET worker process always has read/write access to that folder). For regular apps you should be dropping any database file in common locations that everyone has rights to (or everyone who is using the app).

Put your DBML (linq to sql classes file) in the subfolder of your project where it makes sense vis a vis the namespace. For instance, you'd put it under MyApp/Data or MyApp/Repository or MyApp/Models, etc.

In the .dbml designer, check the properties tool window and make sure you specify the name and namespace for the data context and the entities. Your entity partial classes MUST be in the SAME namespace or the compiler won't know to put them together.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top