コード例 #1
0
 protected MetadataProvider(SqlAliasContainerBuilder aliasContainerBuilder)
 {
     if (aliasContainerBuilder == null)
     {
         throw new ArgumentNullException(nameof(aliasContainerBuilder));
     }
     if (aliasContainerBuilder.RegisteredAliases?.Any() != true)
     {
         throw new ArgumentException("RegisteredAliases contains no elements");
     }
     _aliasContainer = new SqlAliasContainer(aliasContainerBuilder.RegisteredAliases);
 }
コード例 #2
0
        public static void Initialize(SqlAliasContainerBuilder aliasContainerBuilder)
        {
            if (aliasContainerBuilder == null)
            {
                throw new ArgumentNullException(nameof(aliasContainerBuilder));
            }
            if (aliasContainerBuilder.RegisteredAliases?.Any() != true)
            {
                throw new ArgumentException("RegisteredAliases contains no elements");
            }
            var provider = Instance as MetadataProvider;

            if (provider == null)
            {
                throw new InvalidOperationException("The method supports only the default metadata provider");
            }
            provider._aliasContainer = new SqlAliasContainer(aliasContainerBuilder.RegisteredAliases);
        }