-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
226 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,72 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
using MasterMemory; | ||
using MessagePack; | ||
|
||
Console.WriteLine("Hello, World!"); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
public enum Gender | ||
{ | ||
Male, Female, Unknown | ||
} | ||
|
||
[MemoryTable("person"), MessagePackObject(true)] | ||
public class Person | ||
{ | ||
[PrimaryKey(keyOrder: 1)] | ||
public int PersonId { get; set; } | ||
[SecondaryKey(0), NonUnique] | ||
[SecondaryKey(2, keyOrder: 1), NonUnique] | ||
public int Age { get; set; } | ||
[SecondaryKey(1), NonUnique] | ||
[SecondaryKey(2, keyOrder: 0), NonUnique] | ||
public Gender Gender { get; set; } | ||
public string Name { get; set; } | ||
|
||
public Person() // ? | ||
{ | ||
} | ||
|
||
public Person(int PersonId, int Age, Gender Gender, string Name) | ||
{ | ||
this.PersonId = PersonId; | ||
this.Age = Age; | ||
this.Gender = Gender; | ||
this.Name = Name; | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return $"{PersonId} {Age} {Gender} {Name}"; | ||
} | ||
} | ||
|
||
[MemoryTable("monster"), MessagePackObject(true)] | ||
public class Monster | ||
{ | ||
[PrimaryKey] | ||
public int MonsterId { get; private set; } | ||
public string Name { get; private set; } | ||
public int MaxHp { get; private set; } | ||
|
||
public Monster(int MonsterId, string Name, int MaxHp) | ||
{ | ||
this.MonsterId = MonsterId; | ||
this.Name = Name; | ||
this.MaxHp = MaxHp; | ||
} | ||
} | ||
|
||
[MemoryTable("enumkeytable"), MessagePackObject(true)] | ||
public class EnumKeyTable | ||
{ | ||
[PrimaryKey] | ||
public Gender Gender { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters