Asked by:
Zentity Data Extensibility User Guide Problems

Question
-
Hi,
I am currently working on the Data Extensibility User Guide walkthrough and am currently faced with 2 problems:
1) Upon running the program, an error as such : "ResourceType names are already a part of another data model: [ScholarlyWork] "
I then went on to make a check in the Zentity database and found the resource and tried modifying the naming convention to another, however, I am then faced with another error,
2) Procedure or function CreateOrUpdateResourceType ahstoo many arugments specfied.
Which in this case, is that the current has 7 arguments, but by changing the naming convention, the programs view it as 8 arguments
I believe this might be a bug, and any advice would be good !
Thanks
Wednesday, August 10, 2011 3:20 AM
All replies
-
Hi Yong,
Can you tell me which example from the Walkthroughs you are doing?
Regards
Wednesday, August 10, 2011 12:04 PM -
Hi Kalnemi,
I am working on the Creating Module Assembly and EF artifacts.
Thursday, August 11, 2011 3:04 AM -
Hi,
What convention you are using Yong. I am not sure whether there is any bug in it. Anyway, following is a correct way of passing the parameters to this function:-
EXEC [Core].[CreateOrUpdateResourceType]
'f0b6249c-94f7-48d3-a8cd-c70a390b7403','6fe29bdb-eaf0-430b-a6d8-0e16a13b82c3','d2bd64df-6609-4ea4-ae99-9669da69bf7a','ScholarlyWorkItem','urn:zentity/module/zentity-scholarly-works/resource-type/scholarly-work-item','Represents the base resource type for all the types in ScholarlyWorks module.',29
-Reagrds
Thursday, August 11, 2011 2:00 PM -
To fix the bug, you need to place one more variable to the Core.CretaeOrUpdateResourceType stored procedure. Please see the stored procedure file attached. The source of the bug is the dynamic stored procedure created in the Zentity.Core.SqlScriptGenerator class in the ../Product/Zentity.Core/DataModelling folder. The 8th parameter(configXML, see attached screenshot) has other dependencies, removing it will require changes in many other places.
USE [Zentity] GO /****** Object: StoredProcedure [Core].[CreateOrUpdateResourceType] Script Date: 10/06/2011 14:24:17 ******/ 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
Wednesday, December 26, 2012 11:20 AM