Zentity: Different versions of stored procedure Core.CreateOrUpdateResourceType
-
8. februar 2012 14:59I am in the process of creating a Zentity Data Model Module that extends the core ZDM. After re-creating the "Zentity" database (as per the Data Modeling Extension Guide Doc) and executing the Zentity.Core.DataModel.Synchronize() method, I was getting an exception for the stored procedure "Core.CreateOrUpdateResourceType". It seems that the script that is provided in the <install path for Zentity>\Zentity\Scripts\Database.sql creates this stored procedure with one less parameter than the database which is created when using the installer. The missing parameter is "@ConfigurationXML". My question is: Which version is correct? Do I need a different version of the Zentity.Core.DataModel source code or a different version of the database stored procedures?
Devhead
Alle besvarelser
-
9. februar 2012 12:19
The Zentity application is correct. The bug is in the stored procedure. To fix the bug, you need to modify the
Core.CretaeOrUpdateResourceType stored procedure. Do not remove the 8th parameter which has other dependencies
as shown in the screen shot. The correct stored procedure is given below.USE [Zentity] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [Core].[CreateOrUpdateResourceType] @Id UNIQUEIDENTIFIER, @DataModelModuleId UNIQUEIDENTIFIER, @BaseTypeId UNIQUEIDENTIFIER, @Name NVARCHAR (100), @Uri NVARCHAR (1024), @Description NVARCHAR (4000), @Discriminator INT, @configXml NVARCHAR (4000) AS BEGIN IF (SELECT COUNT(1) FROM [Core].[ResourceType] WHERE Id = @Id) = 0 BEGIN INSERT INTO [Core].[ResourceType] ([Id] ,[DataModelModuleId] ,[BaseTypeId] ,[Name] ,[Uri] ,[Description] ,[Discriminator]) VALUES (@Id ,@DataModelModuleId ,@BaseTypeId ,@Name ,@Uri ,@Description ,@Discriminator); END ELSE BEGIN UPDATE [Core].[ResourceType] SET [DataModelModuleId] = @DataModelModuleId ,[BaseTypeId] = @BaseTypeId ,[Name] = @Name ,[Uri] = @Uri ,[Description] = @Description ,[Discriminator] = @Discriminator WHERE [Id] = @Id END -- Update the max discriminator value. DECLARE @MaxDiscriminator [int]; DECLARE @ConfigurationExists [bit]; SELECT @ConfigurationExists = 1, @MaxDiscriminator = [ConfigValue] FROM [Core].[Configuration] WHERE [ConfigName] = 'MaxDiscriminator'; IF @ConfigurationExists IS NULL BEGIN INSERT INTO [Core].[Configuration] SELECT 'MaxDiscriminator', CASE WHEN MAX([Discriminator]) > @Discriminator THEN MAX([Discriminator]) ELSE @Discriminator END FROM [Core].[ResourceType]; END ELSE BEGIN UPDATE [Core].[Configuration] SET [ConfigValue] = CASE WHEN CAST([ConfigValue] AS [int]) > @Discriminator THEN [ConfigValue] ELSE @Discriminator END WHERE [ConfigName] = 'MaxDiscriminator'; END END
- Markeret som svar af Gump 9. februar 2012 15:14