Esempio n. 1
0
        void BindTypes()
        {
            foreach (var mapping in Mappings.Values)
            {
                BindType(mapping, _connector, externalCall: false);
            }

            // Enums
            var enumFactory = new UnmappedEnumTypeHandlerFactory(DefaultNameTranslator);

            foreach (var e in DatabaseInfo.EnumTypes.Where(e => !_byOID.ContainsKey(e.OID)))
            {
                BindType(enumFactory.Create(e, _connector.Connection !), e);
            }

            // Wire up any domains we find to their base type mappings, this is important
            // for reading domain fields of composites
            foreach (var domain in DatabaseInfo.DomainTypes)
            {
                if (_byOID.TryGetValue(domain.BaseType.OID, out var baseTypeHandler))
                {
                    _byOID[domain.OID] = baseTypeHandler;
                    if (domain.Array != null)
                    {
                        BindType(baseTypeHandler.CreateArrayHandler(domain.Array), domain.Array);
                    }
                }
            }
        }
        void BindTypes()
        {
            foreach (var mapping in Mappings.Values)
            {
                BindType(mapping, _connector, false);
            }

#if !NETSTANDARD1_3
            // Composites
            var dynamicCompositeFactory = new UnmappedCompositeTypeHandlerFactory(DefaultNameTranslator);
            foreach (var compType in DatabaseInfo.CompositeTypes.Where(e => !_byOID.ContainsKey(e.OID)))
            {
                BindType(dynamicCompositeFactory.Create(compType, _connector.Connection), compType);
            }
#endif

            // Enums
            var enumFactory = new UnmappedEnumTypeHandlerFactory(DefaultNameTranslator);
            foreach (var e in DatabaseInfo.EnumTypes.Where(e => !_byOID.ContainsKey(e.OID)))
            {
                BindType(enumFactory.Create(e, _connector.Connection), e);
            }

            // Wire up any domains we find to their base type mappings, this is important
            // for reading domain fields of composites
            foreach (var domain in DatabaseInfo.DomainTypes)
            {
                if (_byOID.TryGetValue(domain.BaseType.OID, out var baseTypeHandler))
                {
                    _byOID[domain.OID] = baseTypeHandler;
                }
            }
        }