예제 #1
0
        private IStructuralEquatable GetKey(IDataRecord dataRecord)
        {
            Func <IDataRecord, IStructuralEquatable> keyDelegate = keyDelegateBuilder.CreateKeyDelegate(typeof(T), dataRecord);

            if (keyDelegate == null)
            {
                return(null);
            }

            var key = keyDelegate(dataRecord);

            return(key);
        }
예제 #2
0
 /// <summary>
 /// Creates a function delegate that returns a <see cref="IStructuralEquatable"/> instance,
 /// representing the key values for the given <paramref name="type"/>.
 /// </summary>
 /// <param name="type">The <see cref="Type"/> for which to build the delegate.</param>
 /// <param name="dataRecord">The <see cref="IDataRecord"/> containing the target fields/columns.</param>
 /// <returns>A function delegate used to retrieve key values for the given <paramref name="type"/>.</returns>
 public Func <IDataRecord, IStructuralEquatable> CreateKeyDelegate(Type type, IDataRecord dataRecord)
 {
     return(cache.GetOrAdd(type, t => keyDelegateBuilder.CreateKeyDelegate(t, dataRecord)));
 }