/Student.cs
Created Sep 3, 2015
Student - a sample document
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using Microsoft.Azure.Documents; | |
| namespace DocumentDBPerfScaleTest | |
| { | |
| public class Student | |
| { | |
| private static readonly int Seed = 79736584; | |
| public Guid StudentId { get; set; } | |
| public string Name { get; set; } | |
| public IList<StudentScore> Scores { get; set; } | |
| public string Department { get; set; } | |
| public int Year { get; set; } | |
| public int Semester { get; set; } | |
| public static Student CreateStudent( string StudentName) | |
| { | |
| return new Student() | |
| { | |
| StudentId = CreateGuid(), | |
| Name = StudentName, | |
| Department = "Language", | |
| Year = 1, | |
| Semester = 2, | |
| Scores = new StudentScore[] | |
| { | |
| new StudentScore() | |
| { | |
| Type = "Exam", Score = 44.871863 | |
| }, | |
| new StudentScore() | |
| { | |
| Type = "Homework", Score = 10.530585 | |
| }, | |
| new StudentScore() | |
| { | |
| Type = "Quiz", Score = 19.218864 | |
| } | |
| } | |
| }; | |
| } | |
| private static Guid CreateGuid() | |
| { | |
| var random = new Random(Seed); | |
| Guid guid = NewGuidByRandom(random); | |
| return guid; | |
| } | |
| private static Guid NewGuidByRandom(Random random) | |
| { | |
| var guidBytes = new byte[16]; | |
| random.NextBytes(guidBytes); | |
| guidBytes[7] &= 0x0F; | |
| guidBytes[7] |= 0x40; | |
| guidBytes[8] &= 0x3F; | |
| guidBytes[8] |= 0x80; | |
| return new Guid(guidBytes); | |
| } | |
| } | |
| public class StudentScore | |
| { | |
| public string Type { get; set; } | |
| public double Score { get; set; } | |
| } | |
| public enum ScoreType | |
| { | |
| Exam, | |
| Quiz, | |
| Homework | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment