INNER CODE UNIT · C#

Employee

BlueshiftSoftware/EntityFrameworkCore · src/Blueshift.EntityFrameworkCore.MongoDB.SampleDomain/ZooDbContext.cs:93

    public class Employee
    {
        // When using attribute-driven data modeling, either [BsonId] or [Key]
        // is required for the primary key field; either will work with the
        // MongoDb C# driver EFCore adapter
        [BsonId, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public ObjectId EmployeeId { get; [UsedImplicitly] private set; }

        public string FirstName { get; set; }

        public string LastName { get; set; }

        [BsonElement]
        public string FullName => string.IsNullOrWhiteSpace(FirstName)
            ? LastName
            : $"{LastName}, {FirstName}";

        public decimal Age { get; set; }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…