Skip to content

mdawood1991/EFIssue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EFIssue

The SQL Script the DB is (I haven't enabled the migrations on these projects yet):

CREATE DATABASE [EF6Context]
GO

USE [EF6Context]
GO
/****** Object:  Table [dbo].[Asset]    Script Date: 16/11/2021 23:09:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Asset](
	[AssetId] [int] IDENTITY(1,1) NOT NULL,
 CONSTRAINT [PK_Asset] PRIMARY KEY CLUSTERED 
(
	[AssetId] 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]
GO
/****** Object:  Table [dbo].[MonitoringLog]    Script Date: 16/11/2021 23:09:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringLog](
	[MonitoringLogId] [int] IDENTITY(1,1) NOT NULL,
	[LogUTCDateTime] [datetime] NOT NULL,
	[OtherProperty] [nvarchar](50) NULL,
	[AssetId] [int] NOT NULL,
 CONSTRAINT [PK_MonitoringLog] PRIMARY KEY CLUSTERED 
(
	[MonitoringLogId] 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]
GO
ALTER TABLE [dbo].[MonitoringLog]  WITH CHECK ADD  CONSTRAINT [FK_MonitoringLog_Asset] FOREIGN KEY([AssetId])
REFERENCES [dbo].[Asset] ([AssetId])
GO
ALTER TABLE [dbo].[MonitoringLog] CHECK CONSTRAINT [FK_MonitoringLog_Asset]
GO

Insert some test data:

SET IDENTITY_INSERT Asset ON;
INSERT INTO Asset	(AssetId)
	VALUES (1), (2)

GO
SET IDENTITY_INSERT Asset ON;

DECLARE @rows int = 1000, @i int = 1

WHILE @i < @rows
BEGIN
	INSERT INTO MonitoringLog (LogUTCDateTime, OtherProperty, AssetId)
		VALUES
		(GetDate(), 'hello world', 1),
		(GetDate(), 'hello world', 2)

	SET @i = @i + 1;
END

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages