# Is this documentation still up to date?

**URL:** <https://forum.radzen.com/t/is-this-documentation-still-up-to-date/10371>\
**Category:** Blazor WebAssembly\
**Created:** [March 17, 2022, 10:33pm UTC](https://forum.radzen.com/t/is-this-documentation-still-up-to-date/10371 "2022-03-17T22:33:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![TMRGlobal](https://forum.radzen.com/letter_avatar_proxy/v4/letter/t/7993a0/32.png) [@TMRGlobal](https://forum.radzen.com/u/TMRGlobal)\
**Post date:** [March 17, 2022, 10:33pm UTC](https://forum.radzen.com/t/is-this-documentation-still-up-to-date/10371/1 "2022-03-17T22:33:51Z")

</div>

Hi guys,

i'm looking at the following Blazor documentation  
[Customize CRUD pages | Create a Blazor CRM application with Radzen (Blazor)](https://www.radzen.com/documentation/blazor/crm/customize-crud/)

as i want to record the user.ID with each Create Table action, i.e.  
[some table].[createdById] = [aspnetusers].[id] of the logged in user

however, following the directory path specified in the documentaiton  
server\Services\CrmService.Custom.cs

the path "server\Services" doesn't exist  
i do note however that "client\Services" does exist, so just checking if this example and sample code is still up to date reflective of the code base today?

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [March 18, 2022, 6:27am UTC](https://forum.radzen.com/t/is-this-documentation-still-up-to-date/10371/2 "2022-03-18T06:27:00Z")

</div>

The section [you are reading](https://www.radzen.com/documentation/blazor/crm/customize-crud/#server-side-blazor) is for blazor server. [A bit below](https://www.radzen.com/documentation/blazor/crm/customize-crud/#client-side-webassembly-blazor) is another one for blazor web assembly.

---

<div class="post-metadata">

**Author:** ![TMRGlobal](https://forum.radzen.com/letter_avatar_proxy/v4/letter/t/7993a0/32.png) [@TMRGlobal](https://forum.radzen.com/u/TMRGlobal)\
**Post date:** [March 19, 2022, 4:01am UTC](https://forum.radzen.com/t/is-this-documentation-still-up-to-date/10371/3 "2022-03-19T04:01:06Z")

</div>

thanks @korchev not the first time the problem existed with the user 😃

---

<div class="post-metadata">

**Author:** ![TMRGlobal](https://forum.radzen.com/letter_avatar_proxy/v4/letter/t/7993a0/32.png) [@TMRGlobal](https://forum.radzen.com/u/TMRGlobal)\
**Post date:** [March 20, 2022, 12:03am UTC](https://forum.radzen.com/t/is-this-documentation-still-up-to-date/10371/4 "2022-03-20T00:03:21Z")

</div>

okay, nearly there, i have an issue with the HTTPContext

```auto
        partial void OnCredentialCreated(Credential item)
        {
            var userManager = (UserManager<ApplicationUser>)HttpContext.RequestServices.GetService(typeof(UserManager<ApplicationUser>));

            var userId = userManager.GetUserId(HttpContext.User);

            // Set the UserId property of the opportunity to the current user's id
            item.CreatdById = userId;
        }

```

the rror i have is;  
CS0103 The name 'HttpContext' does not exist in the current context

as a potential fix, i can add the reference using Microsoft.AspNetCore.Http;

but that then breaks the Request Services

---

<div class="post-metadata">

**Author:** ![TMRGlobal](https://forum.radzen.com/letter_avatar_proxy/v4/letter/t/7993a0/32.png) [@TMRGlobal](https://forum.radzen.com/u/TMRGlobal)\
**Post date:** [March 20, 2022, 12:06am UTC](https://forum.radzen.com/t/is-this-documentation-still-up-to-date/10371/5 "2022-03-20T00:06:20Z")

</div>

full code here;

```auto
using System;
using System.Data;
using System.Linq;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using TmrGovernance.Models;
using TmrGovernance.Models.TmrRadzen;

namespace BlazorCrmWasm.Controllers.Crm
{
    [Authorize]
    public partial class CredentialsController
    {
        partial void OnCredentialsRead(ref IQueryable<Credential> items)
        {
            var userManager = (UserManager<ApplicationUser>)HttpContext.RequestServices.GetService(typeof(UserManager<ApplicationUser>));

            var user = userManager.GetUserAsync(HttpContext.User).Result;
            if (user != null)
            {
                var roles = userManager.GetRolesAsync(user).Result;

                if (roles.Contains("Sales Manager"))
                {
                    // Filter the opportunities by the current user's id
                    items = items.Where(item => item.CreatdById == user.Id);
                }
            }
        }

        partial void OnCredentialCreated(Credential item)
        {
            var userManager = (UserManager<ApplicationUser>)HttpContext.RequestServices.GetService(typeof(UserManager<ApplicationUser>));

            var userId = userManager.GetUserId(HttpContext.User);

            // Set the UserId property of the opportunity to the current user's id
            item.CreatdById = userId;
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![TMRGlobal](https://forum.radzen.com/letter_avatar_proxy/v4/letter/t/7993a0/32.png) [@TMRGlobal](https://forum.radzen.com/u/TMRGlobal)\
**Post date:** [March 20, 2022, 9:20am UTC](https://forum.radzen.com/t/is-this-documentation-still-up-to-date/10371/6 "2022-03-20T09:20:40Z")

</div>

Found it.... i had the original namespace from the sample code instead of the correct namespace;

```auto
using System;
using System.Data;
using System.Linq;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using TmrGovernance.Models;
using TmrGovernance.Models.TmrRadzen;

namespace TmrGovernance.Controllers.TmrRadzen
{
    [Authorize]
    public partial class CredentialsController
    {
        partial void OnCredentialsRead(re

```

---

<div class="post-metadata">

**Author:** ![TMRGlobal](https://forum.radzen.com/letter_avatar_proxy/v4/letter/t/7993a0/32.png) [@TMRGlobal](https://forum.radzen.com/u/TMRGlobal)\
**Post date:** [March 20, 2022, 10:55pm UTC](https://forum.radzen.com/t/is-this-documentation-still-up-to-date/10371/7 "2022-03-20T22:55:37Z")

</div>

one step forward....  
i believe i have replicated the code appropriatly, and removed the updated fields from the Add form

when i'm testing this however i can see there are no values coming through from the code;

```auto
dotnet: fail: Microsoft.EntityFrameworkCore.Database.Command[20102]he 
      Failed executing DbCommand (1ms) [Parameters=[@p0='?' (DbType = Guid), @p1='?' (Size = 4000), @p2='?' (DbType = DateTime), @p3='?' (Size = 4000), @p4='?' (DbType = DateTime), @p5='?' (DbType = DateTime), @p6='?' (Size = 4000), @p7='?' (Size = 450), @p8='?' (Size = 4000), @p9='?' (Size = 4000), @p10='?' (Size = 450), @p11='?' (DbType = Guid), @p12='?' (Size = 4000), @p13='?' (Size = 4000), @p14='?' (Size = 4000), @p15='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30']
      SET NOCOUNT ON;
      INSERT INTO [dbo].[Credentials] ([Id], [CreatdById], [CreatedDt], [CredentialStatus], [DateOfExpiry], [DateOfObtainment], [DisplayId], [GovernanceOwnerId], [GrantingBody], [Name], [OwnerId], [ParentId], [PrincilePlaceOfProfessionAddress], [PrinciplePlaceOfProfession], [RegistrationNumber], [Status])
      VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13, @p14, @p15);

dotnet: fail: Microsoft.EntityFrameworkCore.Update[10000]
      An exception occurred in the database while saving changes for context type 'TmrGovernance.Data.TmrRadzenContext'.
      Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
       ---> System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
         at System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value)
         at System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value)
         at System.Data.SqlTypes.SqlDateTime..ctor(DateTime value)
         at Microsoft.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb)
         at Microsoft.Data.SqlClient.TdsParser.WriteUnterminatedValue(Object value, MetaType type, Byte scale, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj, Int32 paramSize, Boolean isDataFeed)
         at Microsoft.Data.SqlClient.TdsParser.TDSExecuteRPCAddParameter(TdsParserStateObject stateObj, SqlParameter param, MetaType mt, Byte options)
         at Microsoft.Data.SqlClient.TdsParser.TdsExecuteRPC(SqlCommand cmd, _SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource`1 completion, Int32 startRpc, Int32 startParam)
         at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
         at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
         at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
         at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
         at Microsoft.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
         at System.Data.Common.DbCommand.ExecuteReader()
         at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
         at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
         --- End of inner exception stack trace ---
         at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
         at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
         at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__104_0(DbContext _, ValueTuple`2 t)
         at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
         at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
      Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
       ---> System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
         at System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value)
         at System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value)
         at System.Data.SqlTypes.SqlDateTime..ctor(DateTime value)
         at Microsoft.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb)
         at Microsoft.Data.SqlClient.TdsParser.WriteUnterminatedValue(Object value, MetaType type, Byte scale, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj, Int32 paramSize, Boolean isDataFeed)
         at Microsoft.Data.SqlClient.TdsParser.TDSExecuteRPCAddParameter(TdsParserStateObject stateObj, SqlParameter param, MetaType mt, Byte options)

dotnet: at Microsoft.Data.SqlClient.TdsParser.TdsExecuteRPC(SqlCommand cmd, _SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource`1 completion, Int32 startRpc, Int32 startParam)
         at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
         at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
         at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
         at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
         at Microsoft.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
         at System.Data.Common.DbCommand.ExecuteReader()
         at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
         at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
         --- End of inner exception stack trace ---
         at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
         at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
         at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__104_0(DbContext _, ValueTuple`2 t)
         at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
         at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)

```

anyone have any thoughts on this ?

---

<div class="post-metadata">

**Author:** ![TMRGlobal](https://forum.radzen.com/letter_avatar_proxy/v4/letter/t/7993a0/32.png) [@TMRGlobal](https://forum.radzen.com/u/TMRGlobal)\
**Post date:** [March 20, 2022, 11:36pm UTC](https://forum.radzen.com/t/is-this-documentation-still-up-to-date/10371/8 "2022-03-20T23:36:39Z")

</div>

okay further testing....  
i backed out the change and again attempted to create a record,

similar issue with this form.

i suspect there is an underlying issue with the database schema as this table has a self-referencing hierarchy in it.

but an out of the box form using the CRUD generator on this table, including all references isn't working.

```auto
dotnet: fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
      Failed executing DbCommand (2ms) [Parameters=[@p0='?' (DbType = Guid), @p1='?' (Size = 450), @p2='?' (DbType = DateTime), @p3='?' (Size = 4000), @p4='?' (DbType = DateTime), @p5='?' (DbType = DateTime), @p6='?' (Size = 4000), @p7='?' (Size = 450), @p8='?' (Size = 4000), @p9='?' (Size = 4000), @p10='?' (Size = 450), @p11='?' (DbType = Guid), @p12='?' (Size = 4000), @p13='?' (Size = 4000), @p14='?' (Size = 4000), @p15='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30']
      SET NOCOUNT ON;
      INSERT INTO [dbo].[Credentials] ([Id], [CreatdById], [CreatedDt], [CredentialStatus], [DateOfExpiry], [DateOfObtainment], [DisplayId], [GovernanceOwnerId], [GrantingBody], [Name], [OwnerId], [ParentId], [PrincilePlaceOfProfessionAddress], [PrinciplePlaceOfProfession], [RegistrationNumber], [Status])
      VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13, @p14, @p15);

dotnet: fail: Microsoft.EntityFrameworkCore.Update[10000]
      An exception occurred in the database while saving changes for context type 'TmrGovernance.Data.TmrRadzenContext'.
      Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
       ---> System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
         at System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value)
         at System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value)
         at System.Data.SqlTypes.SqlDateTime..ctor(DateTime value)
         at Microsoft.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb)
         at Microsoft.Data.SqlClient.TdsParser.WriteUnterminatedValue(Object value, MetaType type, Byte scale, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj, Int32 paramSize, Boolean isDataFeed)
         at Microsoft.Data.SqlClient.TdsParser.TDSExecuteRPCAddParameter(TdsParserStateObject stateObj, SqlParameter param, MetaType mt, Byte options)
         at Microsoft.Data.SqlClient.TdsParser.TdsExecuteRPC(SqlCommand cmd, _SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource`1 completion, Int32 startRpc, Int32 startParam)
         at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
         at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
         at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
         at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
         at Microsoft.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
         at System.Data.Common.DbCommand.ExecuteReader()
         at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
         at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
         --- End of inner exception stack trace ---
         at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
         at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)

dotnet: at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__104_0(DbContext _, ValueTuple`2 t)
         at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
         at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
      Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
       ---> System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
         at System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value)
         at System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value)
         at System.Data.SqlTypes.SqlDateTime..ctor(DateTime value)
         at Microsoft.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb)
         at Microsoft.Data.SqlClient.TdsParser.WriteUnterminatedValue(Object value, MetaType type, Byte scale, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj, Int32 paramSize, Boolean isDataFeed)
         at Microsoft.Data.SqlClient.TdsParser.TDSExecuteRPCAddParameter(TdsParserStateObject stateObj, SqlParameter param, MetaType mt, Byte options)
         at Microsoft.Data.SqlClient.TdsParser.TdsExecuteRPC(SqlCommand cmd, _SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource`1 completion, Int32 startRpc, Int32 startParam)
         at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
         at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
         at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
         at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
         at Microsoft.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
         at System.Data.Common.DbCommand.ExecuteReader()
         at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
         at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
         --- End of inner exception stack trace ---
         at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
         at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
         at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__104_0(DbContext _, ValueTuple`2 t)
         at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
         at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)

```

the table schema applied is as per below;

```auto
USE [TMRRadzen]
GO

/******Object: Table [dbo].[Credentials] Script Date: 21/03/2022 10:30:34 AM******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Credentials](
	[Id] [uniqueidentifier] NOT NULL,
	[DisplayId] [nvarchar](50) NOT NULL,
	[OwnerId] [nvarchar](450) NOT NULL,
	[GovernanceOwnerId] [nvarchar](450) NOT NULL,
	[ParentId] [uniqueidentifier] NULL,
	[Name] [nvarchar](max) NOT NULL,
	[RegistrationNumber] [nvarchar](max) NOT NULL,
	[GrantingBody] [nvarchar](max) NOT NULL,
	[CredentialStatus] [nvarchar](max) NOT NULL,
	[DateOfObtainment] [datetime] NOT NULL,
	[DateOfExpiry] [datetime] NULL,
	[PrinciplePlaceOfProfession] [nvarchar](max) NULL,
	[PrincilePlaceOfProfessionAddress] [nvarchar](max) NULL,
	[CreatdById] [nvarchar](450) NOT NULL,
	[CreatedDt] [datetime] NOT NULL,
	[Status] [int] NOT NULL,
 CONSTRAINT [PK_Credentials] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[Credentials] ADD CONSTRAINT [DF_Credentials_Id] DEFAULT (newid()) FOR [Id]
GO

ALTER TABLE [dbo].[Credentials] ADD CONSTRAINT [DF_Credentials_CreatedDt] DEFAULT (getdate()) FOR [CreatedDt]
GO

ALTER TABLE [dbo].[Credentials] ADD CONSTRAINT [DF_Credentials_Status] DEFAULT ((1)) FOR [Status]
GO

ALTER TABLE [dbo].[Credentials] WITH CHECK ADD CONSTRAINT [FK_Credentials_AspNetUsers] FOREIGN KEY([CreatdById])
REFERENCES [dbo].[AspNetUsers] ([Id])
GO

ALTER TABLE [dbo].[Credentials] CHECK CONSTRAINT [FK_Credentials_AspNetUsers]
GO

ALTER TABLE [dbo].[Credentials] WITH CHECK ADD CONSTRAINT [FK_Credentials_GovernanceOwnerAspNetUsers] FOREIGN KEY([GovernanceOwnerId])
REFERENCES [dbo].[AspNetUsers] ([Id])
GO

ALTER TABLE [dbo].[Credentials] CHECK CONSTRAINT [FK_Credentials_GovernanceOwnerAspNetUsers]
GO

ALTER TABLE [dbo].[Credentials] WITH CHECK ADD CONSTRAINT [FK_Credentials_OwnerAspNetUsers] FOREIGN KEY([OwnerId])
REFERENCES [dbo].[AspNetUsers] ([Id])
GO

ALTER TABLE [dbo].[Credentials] CHECK CONSTRAINT [FK_Credentials_OwnerAspNetUsers]
GO

ALTER TABLE [dbo].[Credentials] WITH CHECK ADD CONSTRAINT [FK_Credentials_ParentCredentials] FOREIGN KEY([ParentId])
REFERENCES [dbo].[Credentials] ([Id])
GO

ALTER TABLE [dbo].[Credentials] CHECK CONSTRAINT [FK_Credentials_ParentCredentials]
GO

```

note on this table there is the FK link to itself using the parent ID and Parent ID is a nullable GUID

---

<div class="post-metadata">

**Author:** ![TMRGlobal](https://forum.radzen.com/letter_avatar_proxy/v4/letter/t/7993a0/32.png) [@TMRGlobal](https://forum.radzen.com/u/TMRGlobal)\
**Post date:** [March 21, 2022, 12:24am UTC](https://forum.radzen.com/t/is-this-documentation-still-up-to-date/10371/9 "2022-03-21T00:24:32Z")

</div>

so just a further FYI test,

i attempted this update on an alternate page without the self referencing FK and it worked perfectly

getting there 🙂 back to solving the problem with a nullable self referencing GUID
