ConfigurationInfo GetConfigurationInfo()
        {
            if (_configurationInfo == null && !_configurations.TryGetValue(Configuration ?? "", out _configurationInfo))
            {
                var client = GetClient();

                try
                {
                    var info = client.GetInfo(Configuration);

                    var type = Type.GetType(info.MappingSchemaType) !;
                    var ms   = new RemoteMappingSchema(ContextIDPrefix, (MappingSchema)Activator.CreateInstance(type));

                    _configurationInfo = new ConfigurationInfo
                    {
                        LinqServiceInfo = info,
                        MappingSchema   = ms,
                    };
                }
                finally
                {
                    (client as IDisposable)?.Dispose();
                }
            }

            return(_configurationInfo);
        }
Example #2
0
        ConfigurationInfo GetConfigurationInfo()
        {
            if (_configurationInfo == null && !_configurations.TryGetValue(Configuration ?? "", out _configurationInfo))
            {
                var client = GetClient();

                try
                {
                    var info = client.GetInfo(Configuration);

                    MappingSchema ms;

                    if (string.IsNullOrEmpty(info.MappingSchemaType))
                    {
                        ms = new MappingSchema(
                            info.ConfigurationList
                            .Select(c => ContextIDPrefix + "." + c).Concat(new[] { ContextIDPrefix }).Concat(info.ConfigurationList)
                            .Select(c => new MappingSchema(c)).Concat(new[] { MappingSchema.Default })
                            .ToArray());
                    }
                    else
                    {
                        var type = Type.GetType(info.MappingSchemaType);
                        ms = new RemoteMappingSchema(ContextIDPrefix, (MappingSchema)Activator.CreateInstance(type));
                    }

                    _configurationInfo = new ConfigurationInfo
                    {
                        LinqServiceInfo = info,
                        MappingSchema   = ms,
                    };
                }
                finally
                {
                    ((IDisposable)client).Dispose();
                }
            }

            return(_configurationInfo);
        }