public virtual void LoadSettings(IProjectSettings settings) { Contract.Assert(settings != null); bool boolValue; if (settings.TryGetBool(SavedSettingsKeys.IsLayoutPageSelectedKey, out boolValue)) { IsLayoutPageSelected = boolValue; } if (settings.TryGetBool(SavedSettingsKeys.IsPartialViewSelectedKey, out boolValue)) { IsPartialViewSelected = boolValue; } if (settings.TryGetBool(SavedSettingsKeys.IsReferencingScriptLibrariesSelectedKey, out boolValue)) { IsReferenceScriptLibrariesSelected = boolValue; } string stringValue; if (settings.TryGetString(SavedSettingsKeys.LayoutPageFileKey, out stringValue)) { LayoutPageFile = stringValue; } if (IsModelClassSupported && settings.TryGetString(SavedSettingsKeys.DbContextTypeFullNameKey, out stringValue)) { DataContextType = DataContextTypes.Where(t => String.Equals(t.TypeName, stringValue, StringComparison.Ordinal)).FirstOrDefault(); } }
public void LoadSettings(VisualStudio.IProjectSettings settings) { // TODO - Right now this class inherits from the view scaffolder model, so we need to call into the // base class to read those settings as well. We want to remove this inheritance at some point // and this method will have to change when we do. Contract.Assert(settings != null); string stringValue; if (settings.TryGetString(SavedSettingsKeys.DbContextTypeFullNameKey, out stringValue)) { DataContextType = DataContextTypes.Where(t => String.Equals(t.TypeName, stringValue, StringComparison.Ordinal)).FirstOrDefault(); } if (settings.TryGetString(SavedSettingsKeys.ConfigTypeFullNameKey, out stringValue)) { ConfigType = ConfigTypes.Where(t => String.Equals(t.TypeName, stringValue, StringComparison.Ordinal)).FirstOrDefault(); } }
public ConfigScaffolderModel(CodeGenerationContext context) : base(context) { DataContextTypes = ServiceProvider.GetService <ICodeTypeService>().GetAllCodeTypes(ActiveProject) .Where(codeType => codeType.IsValidDbContextType()) .Select(ct => new ModelType(ct)); ConfigTypes = ServiceProvider.GetService <ICodeTypeService>().GetAllCodeTypes(ActiveProject) .Where(codeType => codeType.IsValidConfigType()) .Select(ct => new ModelType(ct)); if (DataContextTypes.FirstOrDefault() == null) { throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, Resources.InvalidResource, "context class")); } if (ConfigTypes.FirstOrDefault() == null) { throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, Resources.InvalidResource, "config class")); } }