I have server and client database where I need to keep some of the server data in sync with client dataabse. Database schema is same apart from having IDENTITY(1,1) on server.
Data can be created on server only. It has to be inserted on client with using server's id.
CREATE TABLE [MyServer].[dbo].[Test1](
[Test1Id] [int] IDENTITY(1,1) NOT NULL,
[Test1Value] [datetime] NOT NULL,
CONSTRAINT [PK_Test1] PRIMARY KEY CLUSTERED ( [Test1Id] ASC ) ) ON [PRIMARY]
CREATE TABLE [MyClient].[dbo].[Test1](
[Test1Id] [int] NOT NULL,
[Test1Value] [datetime] NOT NULL,
CONSTRAINT [PK_Test1] PRIMARY KEY CLUSTERED ( [Test1Id] ASC ) ) ON [PRIMARY]
Is there any way to change StoreGeneratedPattern for entity classes without rebuilding assembly so I can insert IDENTITY on client side? I spent some time looking into
EntityModelCodeGenerator
but without any success.
Of course I run server and client in different app domain so I can do this change on startup.
I am using default EntityFramework classes. I can change to POCO entities if it resolves my problem. Classes are simple and referenced by id's instead of NavigationProperties.
Thanks