public static EncryptedStorageData CreateDefaultContent()
 {
     var content = new EncryptedStorageData
         {
             SharedSettings = new List<SharedConnectionSettings>
                 {
                     new SharedConnectionSettings("default")
                 }
         };
     return content;
 }
        public static EncryptedStorageData CreateDefaultContent()
        {
            var content = new EncryptedStorageData
            {
                SharedSettings = new List <SharedConnectionSettings>
                {
                    new SharedConnectionSettings("default")
                }
            };

            return(content);
        }
        private static void InitializeRelations(EncryptedStorageData data)
        {
            var connectionsByName = data.Connections.ToDictionary(c => c.Name);
            var sharedSettingsByName = data.SharedSettings.ToDictionary(cs => cs.Name);

            foreach (var connectionInfo in data.Connections)
            {
                // Parent
                var parentName = connectionInfo.ParentName;
                if (parentName != null)
                {
                    var parentConnectionInfo = connectionsByName.GetValueOrDefault(parentName);
                    if (parentConnectionInfo != null)
                    {
                        connectionInfo.Parent = parentConnectionInfo;
                    }
                    else
                    {
                        connectionInfo.ParentName = null;
                    }
                }

                // SharedSettings
                var sharedSettingsName = connectionInfo.SharedSettingsName;
                if (sharedSettingsName != null)
                {
                    var sharedSettings = sharedSettingsByName.GetValueOrDefault(sharedSettingsName);
                    if (sharedSettings != null)
                    {
                        connectionInfo.SharedSettings = sharedSettings;
                    }
                    else
                    {
                        connectionInfo.SharedSettingsName = null;
                    }
                }
            }
        }