Ejemplo n.º 1
0
        private void InitializeKey(KeyReader key)
        {
            if (key.Reference != null)
            {
                foreach (DataReader value in key.Values)
                {
                    value.KeyType = value.Metadata.Type.GetKeyType();
                }

                key.KeyType = CompositeKey.Create(key.Values.Select(v => v.KeyType));

                if (key.Values.Count > 1)
                {
                    key.Variable = Expression.Variable(key.KeyType);
                }

                if (key.Reference.HasFlag(ReferenceFlags.Self))
                {
                    key.Reference = this.GetRecursiveReference(key.Reference);
                }
            }

            foreach (DataReader value in key.Values)
            {
                value.IsDbNull ??= this.GetNamedVariable(typeof(bool), value, "_isnull");
                value.Variable ??= this.GetNamedVariable(value.KeyType, value);
            }
        }