예제 #1
0
        public static TSettings CreateInstance <TSettings>(IChangeTracked parent, string encodedSource = "") where TSettings : SettingsContainer
        {
            var createNew          = String.IsNullOrEmpty(encodedSource);
            var serializerSettings = new DefaultSerializeSettings();
            var settings           = !createNew?
                                     JsonConvert.DeserializeObject <TSettings>(encodedSource, serializerSettings) ?? Activator.CreateInstance <TSettings>() :
                                         Activator.CreateInstance <TSettings>();

            settings.Parent = parent;
            if (createNew)
            {
                settings.AfterConstruction();
            }
            settings.AfterCreate();
            return(settings);
        }
 public virtual bool IsModified(IChangeTracked latest)
 {
     return(latest.LastModified > LastModified);
 }