示例#1
0
    public async Task Model_Serialization()
    {
        var sut = new Model("Test");

        sut.Fields.Add(new Field("Field1"));

        var idx = new Index();

        idx.Fields.Add(new IndexField("Field1"));
        sut.Indexes.Add(idx);

        var rel = new Relationship()
        {
            PrincipalModel = new Name("Test"),
            PrincipalType  = RelationshipTypes.One,
            DependantModel = new Name("OtherModel"),
            DependantType  = RelationshipTypes.Many
        };

        rel.PrincipalFields.Add(new Name("Field1"));
        rel.DependantFields.Add(new Name("OtherField"));
        sut.Relationships.Add(rel);

        var json = sut.ToJson();

        await Verifier.VerifyJson(json);

        var actual = json.FromJson <Model>();

        actual.Should().BeEquivalentTo(sut);
    }
示例#2
0
文件: Names.cs 项目: Allann/Modeller
 public static SqlServerIndex SqlServer(this Index index, Model model)
 => new SqlServerIndex(model, index);
示例#3
0
 public SqlServerIndex(Model model, Index index)
 {
     _model = model;
     _index = index;
 }