/// <summary> /// Adds definition of matching of target and source records using primary key columns. /// </summary> /// <typeparam name="TTarget">Target record type.</typeparam> /// <param name="merge">Merge command builder.</param> /// <returns>Returns merge command builder with source, target and match (ON) set.</returns> public static IMergeable <TTarget, TTarget> OnTargetKey <TTarget>(this IMergeableOn <TTarget, TTarget> merge) where TTarget : class { if (merge == null) { throw new ArgumentNullException(nameof(merge)); } return((MergeDefinition <TTarget, TTarget>)merge); }
/// <summary> /// Adds definition of matching of target and source records using match condition. /// </summary> /// <typeparam name="TTarget">Target record type.</typeparam> /// <typeparam name="TSource">Source record type.</typeparam> /// <param name="merge">Merge command builder.</param> /// <param name="matchCondition">Rule to match/join target and source records.</param> /// <returns>Returns merge command builder with source, target and match (ON) set.</returns> public static IMergeable <TTarget, TSource> On <TTarget, TSource>( this IMergeableOn <TTarget, TSource> merge, Expression <Func <TTarget, TSource, bool> > matchCondition) where TTarget : class where TSource : class { if (merge == null) { throw new ArgumentNullException(nameof(merge)); } if (matchCondition == null) { throw new ArgumentNullException(nameof(matchCondition)); } return(((MergeDefinition <TTarget, TSource>)merge).AddOnPredicate(matchCondition)); }
/// <summary> /// Adds definition of matching of target and source records using key value. /// </summary> /// <typeparam name="TTarget">Target record type.</typeparam> /// <typeparam name="TSource">Source record type.</typeparam> /// <typeparam name="TKey">Source and target records join/match key type.</typeparam> /// <param name="merge">Merge command builder.</param> /// <param name="targetKey">Target record match key definition.</param> /// <param name="sourceKey">Source record match key definition.</param> /// <returns>Returns merge command builder with source, target and match (ON) set.</returns> public static IMergeable <TTarget, TSource> On <TTarget, TSource, TKey>( this IMergeableOn <TTarget, TSource> merge, Expression <Func <TTarget, TKey> > targetKey, Expression <Func <TSource, TKey> > sourceKey) where TTarget : class where TSource : class { if (merge == null) { throw new ArgumentNullException(nameof(merge)); } if (targetKey == null) { throw new ArgumentNullException(nameof(targetKey)); } if (sourceKey == null) { throw new ArgumentNullException(nameof(sourceKey)); } return(((MergeDefinition <TTarget, TSource>)merge).AddOnKey(targetKey, sourceKey)); }