예제 #1
0
        private Entity DefineSession(SchemaSpecification dbo, Entity speaker)
        {
            var session = dbo.CreateEntity("Session", table =>
            {
                var fk        = table.CreateForeignKey(speaker);
                var timestamp = table.CreateDateTime2Column("Timestamp");
                table.CreateUniqueIndex(fk.Column, timestamp);
            });

            dbo.CreateMutableProperty(session, "Title", table =>
            {
                table.CreateStringColumn("Title", 255);
            });

            dbo.CreateMutableProperty(session, "Abstract", table =>
            {
                table.CreateStringColumn("Abstract", 2000);
            });

            var deletion = dbo.CreateEntity("SessionDeletion", table =>
            {
                var fk        = table.CreateForeignKey(session);
                var timestamp = table.CreateDateTime2Column("Timestamp");
                table.CreateUniqueIndex(fk.Column, timestamp);
            });

            dbo.CreateEntity("SessionRestoration", table =>
            {
                var fk = table.CreateForeignKey(deletion);
                table.CreateUniqueIndex(fk.Column);
            });

            return(session);
        }
예제 #2
0
        private Entity DefineSpeaker(SchemaSpecification dbo)
        {
            var speaker = dbo.CreateEntity("Speaker", table =>
            {
                var userName = table.CreateStringColumn("UserName", 255);
                table.CreateUniqueIndex(userName);
            });

            dbo.CreateMutableProperty(speaker, "Name", table =>
            {
                table.CreateStringColumn("Name", 100);
            });

            return(speaker);
        }
예제 #3
0
        private void DefineSchedule(SchemaSpecification dbo, Entity conference, Entity acceptance)
        {
            var room = dbo.CreateEntity("Room", table =>
            {
                var conferenceId = table.CreateForeignKey(conference);
                var roomNumber   = table.CreateStringColumn("RoomNumber", 50);
                table.CreateUniqueIndex(conferenceId.Column, roomNumber);
            });

            var timeSlot = dbo.CreateEntity("TimeSlot", table =>
            {
                var conferenceId = table.CreateForeignKey(conference);
                var date         = table.CreateDateColumn("Date");
                var time         = table.CreateTimeColumn("Time", fractionalSeconds: 0);
                table.CreateUniqueIndex(conferenceId.Column, date, time);
            });

            dbo.CreateMutableProperty(acceptance, "Schedule", table =>
            {
                table.CreateForeignKey(room);
                table.CreateForeignKey(timeSlot);
            });
        }