public static FeatureSupportRegistry LoadFromInitData() { var initDataContext = InitDataContext.Resolve(); var featureSupportRegistries = initDataContext.Read <FeatureSupportRegistry>(); var theOne = featureSupportRegistries.SingleOrDefault(); if (theOne == null) { throw new InvalidOperationException("未发现预置数据: " + typeof(FeatureSupportRegistry).Name); } return(theOne); }
public static void SaveToInitData(FeatureSupportRegistry registry) { if (registry == null) { throw new ArgumentNullException("registry"); } //todo validate? var initDataContext = InitDataContext.Resolve(); initDataContext.Save(new List <FeatureSupportRegistry>() { registry }); }