投稿を編集します。3 つのメソッドがデータベース テーブルから行を返すと仮定すると、次docTags
のように tags
なりdocs
ます。docTags は中間テーブルです。1 つのdoc
(ドキュメント) は多数tags
を持つことができ、1 つは多数tag
に属するdocs
ことができます。取得方法:TagKey = "123"
どこで docTags.Add(new Configuration(1, 1));
class Program
{
static void Main(string[] args)
{
}
}
public class Configuration
{
public int DocID { get; set; }
public int TagID { get; set; }
public string Name { get; set; }
public string DocKey { get; set; }
public string TagKey { get; set; }
public Configuration(int _docId,string _name, string _docKey)
{
DocID = _docId;
Name = _name;
DocKey = _docKey;
}
public Configuration(int _tagId,string name, string _dockey,string _tagKey)
{
TagID = _tagId;
Name = name;
TagKey = _tagKey;
}
public Configuration(int _tagId, int _docId)
{
TagID = _tagId;
DocID = _docId;
}
public static List<Configuration> getDocType()
{
List<Configuration> docs = new List<Configuration>();
docs.Add(new Configuration(1,"contract", "xxx"));
docs.Add(new Configuration(2,"Action", "yyy"));
return docs;
}
public static List<Configuration> getTagName()
{
List<Configuration> tags = new List<Configuration>();
tags.Add(new Configuration( 1,"contractid", "123"));
tags.Add(new Configuration(2,"SuperDuper", "332123"));
tags.Add(new Configuration(22, "rama", "yyy"));
tags.Add(new Configuration(32, "aktiv", "123456"));
tags.Add(new Configuration(42, "data ","xx764fhx"));
return tags;
}
public static List<Configuration> getDocTags()
{
List<Configuration> docTags = new List<Configuration>();
docTags.Add(new Configuration(1, 2));
docTags.Add(new Configuration(1, 1));
docTags.Add(new Configuration(1, 22));
docTags.Add(new Configuration(2, 2));
docTags.Add(new Configuration(2, 32));
return docTags;
}
}
}