Beispiel #1
0
        internal Dictionary <string, OleDbPropertyInfo> GetValues()
        {
            Dictionary <string, OleDbPropertyInfo> propertyLookup = null;

            bool mustRelease = false;

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                DangerousAddRef(ref mustRelease);
                if (ADP.PtrZero != this.handle)
                {
                    propertyLookup = new Dictionary <string, OleDbPropertyInfo>(StringComparer.OrdinalIgnoreCase);

                    IntPtr           setPtr      = this.handle;
                    ItagDBPROPINFO   propinfo    = OleDbStructHelpers.CreateTagDbPropInfo();
                    tagDBPROPINFOSET propinfoset = new tagDBPROPINFOSET();

                    for (int i = 0; i < setCount; ++i, setPtr = ADP.IntPtrOffset(setPtr, ODB.SizeOf_tagDBPROPINFOSET))
                    {
                        Marshal.PtrToStructure(setPtr, propinfoset);

                        int    infoCount = propinfoset.cPropertyInfos;
                        IntPtr infoPtr   = propinfoset.rgPropertyInfos;
                        for (int k = 0; k < infoCount; ++k, infoPtr = ADP.IntPtrOffset(infoPtr, ODB.SizeOf_tagDBPROPINFO))
                        {
                            Marshal.PtrToStructure(infoPtr, propinfo);

                            OleDbPropertyInfo propertyInfo = new OleDbPropertyInfo();
                            propertyInfo._propertySet     = propinfoset.guidPropertySet;
                            propertyInfo._propertyID      = propinfo.dwPropertyID;
                            propertyInfo._flags           = propinfo.dwFlags;
                            propertyInfo._vtype           = propinfo.vtType;
                            propertyInfo._supportedValues = propinfo.vValue;
                            propertyInfo._description     = propinfo.pwszDescription;
                            propertyInfo._lowercase       = propinfo.pwszDescription.ToLowerInvariant();
                            propertyInfo._type            = PropertyInfoSet.FromVtType(propinfo.vtType);

                            propertyLookup[propertyInfo._lowercase] = propertyInfo;
                        }
                    }
                }
            }
            finally
            {
                if (mustRelease)
                {
                    DangerousRelease();
                }
            }
            return(propertyLookup);
        }