public void SampleStore() { Console.WriteLine("下一个版本号:{0}", Repos.GetNextReversionID()); RawData bin = new RawData() { Charset = "utf-8", IsCompressed = false, IsText = true, BinaryData = Encoding.UTF8.GetBytes("Hello World!") }; //if (Repos.Exists("test.htm")) //{ //} ProjectData sample = new ProjectData() { Author = "test", ContainerIdentityName = string.Empty, DataSum = ExtensionHelper.GetMD5Hash(bin.BinaryData), Deepth = 0, Name = "test", IdentityName = "test.htm", IncludeBinary = true, CreateDateTimeUTC = DateTime.Now.ToUniversalTime(), ModifiedDateTimeUTC = DateTime.Now.ToUniversalTime(), ModuleConfig = new byte[0], RawConfig = bin.GetBytes(), RepositoryId = Repos.RepositoryId }; Repos.Commit(sample, string.Empty); }
public static void SaveProject(Project project) { using (ProjectRepository repository = new ProjectRepository()) { repository.Add(project); repository.Commit(); } }