I use a lot of SQL Server columns that are defined as calculated columns. Here is an example CREATE TABLE
statement:
CREATE TABLE [dbo].[tbl_Ticket] (
[TicketId] AS CAST( JSON_VALUE( RawJSON, ‘strict $.ticket.id’) AS int ) PERSISTED NOT NULL,
[TicketUrl] AS CAST( JSON_VALUE( RawJSON, ‘lax $.ticket.url’) AS varchar( 255 ) ) PERSISTED,
[Channel] AS CAST( JSON_VALUE( RawJSON, ‘lax $.ticket.via.channel’) AS varchar( 25 ) ) PERSISTED,
[TypeId] int NOT NULL,
[Subject] AS CAST( JSON_VALUE( RawJSON, ‘lax $.ticket.subject’) AS varchar( 255 ) ) PERSISTED,
[Description] AS CAST( JSON_VALUE( RawJSON, ‘lax $.ticket.description’) AS varchar( 255 ) ) PERSISTED,
[PriorityId] int NOT NULL,
[StatusId] int NOT NULL,
[RecipientEmail] AS CAST( JSON_VALUE( RawJSON, ‘lax $.ticket.recipient’) AS varchar( 255 ) ) PERSISTED,
[RequesterId] int NOT NULL,
[SubmitterId] int NOT NULL,
[AssigneeId] int,
[GroupId] int,
[OrganizationId] int,
[HasIncidents] bit NOT NULL, – DEFAULT (0),
[ProblemId] int,
[srcCreated] AS TRY_CAST( JSON_VALUE( RawJSON, ‘strict $.ticket.created_at’) AS varchar ) PERSISTED NOT NULL,
[srcModified] AS TRY_CAST( JSON_VALUE( RawJSON, ‘strict $.ticket.updated_at’) AS varchar ) PERSISTED NOT NULL,
[RawJSON] nvarchar(max) NOT NULL,
[Created] datetime NOT NULL, – DEFAULT (GETDATE()),
[CreatedById] int NOT NULL, – DEFAULT (0),
[Modified] datetime NOT NULL, – DEFAULT (GETDATE()),
[ModifiedById] int NOT NULL, – DEFAULT (0),
);
There is no way to specify these types of columns using DBML.