Hi folks,
We have a simple Table per Type Entity Framework 4.0 model :-
- ALl classes are all POCO's.
- Post class is
abstract
. Discussion
andList
are classes areconcretes
, that inherit's from Posts (as shown in the diagram).
When we try to save a Discussion
, we do the following code :-
Posts.AddObject(discussion);
And the Sql Server syntax is in two parts. The second one errors. Notice the sql schema namespace? why is that? (Code taken from EFProf)
insert [dbo].[Posts]
([Subject],
[UniqueSubject],
[Content],
[CreatedOn],
[ModifiedOn],
[IsVisible],
[UserId])
values('Test Subject' /* @0 */,
'sdfsdfsdfsdfsfdssd' /* @1 */,
'this is a lot of content - pew pew pew' /* @2 */,
'23/09/2010 12:22:08 PM +10:00' /* @3 */,
'23/09/2010 12:22:08 PM +10:00' /* @4 */,
1 /* @5 */,
1 /* @6 */)
select [PostId]
from [dbo].[Posts]
where @@ROWCOUNT > 0
and [PostId] = scope_identity()
insert [XWingModelStoreContainer].[Discussions]
([PostId])
values(20132 /* @0 */)
Notice the table name is [XWingModelStoreContainer].[Discussions] ?? Shouldn't that be [dbo].[Discussions] ?? How can we fix this, please?
.
.
UPDATE:
Also, here's another screen shot of the properties of our designer .. so u can see that we thought that it should be calling [dbo] as that is the default Database Scheme Name
..
and in the Xml edmx
file.. there's two name'd lines..
<edmx:StorageModels>
<Schema Namespace="XWingModel.Store" Alias="Self"
Provider="System.Data.SqlClient" ProviderManifestToken="2008"
xmlns:store="http://schemas.microsoft.com.. snip ..."
xmlns="http://schemas.microsoft.com/ ..snip ..">
<EntityContainer Name="XWingModelStoreContainer">
.....
and ..
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping xmlns="http://schemas.microsoft.c.. snip .." Space="C-S">
<Alias Key="Model" Value="XWingModel" />
<Alias Key="Target" Value="XWingModel.Store" />
<EntityContainerMapping CdmEntityContainer="XWingEntities"
StorageEntityContainer="XWingModelStoreContainer">
.......
Does this also help? I have no idea how those names got there (i'm assuming autogenerated) and how do i need to change them? If so, it looks like it's only possible via the xml file .. which is fine .. but feels ... wrong?
Cheers :)