Welcome to mirror list, hosted at ThFree Co, Russian Federation.

assemblycache.cs « SqlClient « Data « System « System.Data « referencesource « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5fd69f0547e89c4b48db3e4223e3d3e76cb06e0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//------------------------------------------------------------------------------
// <copyright file="assemblycache.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
// <owner current="true" primary="true">Microsoft</owner>
// <owner current="true" primary="false">Microsoft</owner>
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
//ThisAssembly class keeps a map of the following:
//AssemblyName to AssemblyID
//TypeName to TypeID
//AssemblyID to AssemblyRef and State
//TypeID to TypeRef and AssemblyId
//
//Adding an assembly to this class will NOT enable users to create types from that assembly. Users should explicitely add type details and link types to assemblies.
// This class also registers for assembly resolve events so that dependent assemblies can be resolved if they are registered.
//This class does NOT know anything about assembly dependencies. It simply loads assemblies as handed over to it.
//Users can take advantage of connection pooling by tying this instance to a pooling-aware component.
//------------------------------------------------------------------------------

using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Globalization;
using System.Diagnostics;
using System.Data.Sql;
using System.Data.SqlTypes;
using System.IO;
using System.Security;
using System.Security.Policy;
using System.Security.Permissions;
using System.Data.Common;

using Microsoft.SqlServer.Server;

namespace System.Data.SqlClient {

    internal sealed class AssemblyCache {
        private AssemblyCache() { /* prevent utility class from being insantiated*/
        }

        internal static int GetLength(Object inst){
            //caller should have allocated enough, based on MaxByteSize
            return SerializationHelperSql9.SizeInBytes(inst);
        }

        //The attribute we are looking for is now moved to an external dll that server provides. If the name is changed.
        //then we we have to make corresponding changes here.
        //please also change sqludcdatetime.cs, sqltime.cs and sqldate.cs

        internal static SqlUdtInfo GetInfoFromType(Type t) {
            Debug.Assert(t != null, "Type object cant be NULL");

            Type orig = t;
            do {
                SqlUdtInfo attr = SqlUdtInfo.TryGetFromType(t);

                if (attr != null ) {
                    return attr;
                }
                else {
                    t = t.BaseType;
                }
            }
            while (t != null);

            throw SQL.UDTInvalidSqlType(orig.AssemblyQualifiedName);
        }
    }
}