public KeyJoinAppender(ILink <Tuple <List <T1>, List <T2> > > previousLink, Func <T1, TKey> primaryKeyExpression, Func <T2, TKey> foreignKeyExpression, string targetCollectionName, JoinOptions joinOptions) : base(previousLink) { if (previousLink == null) { throw new ArgumentNullException("previousLink", "previousLink is null."); } if (primaryKeyExpression == null) { throw new ArgumentNullException("primaryKeyExpression", "primaryKeyExpression is null."); } if (foreignKeyExpression == null) { throw new ArgumentNullException("foreignKeyExpression", "foreignKeyExpression is null."); } if (string.IsNullOrEmpty(targetCollectionName)) { throw new ArgumentException("targetCollectionName is null or empty.", "targetCollectionName"); } var targetPropertyStub = MetadataCache.GetMetadata(typeof(T1)).Properties[targetCollectionName]; //don't inline this variable. m_TargetCollectionExpression = (p) => (ICollection <T2>)targetPropertyStub.InvokeGet(p); m_ForeignKeyExpression = foreignKeyExpression; m_PrimaryKeyExpression = primaryKeyExpression; m_JoinOptions = joinOptions; }
static extern uint NetJoinDomain( string lpServer, string lpDomain, string lpAccountOU, string lpAccount, string lpPassword, JoinOptions NameType);
public KeyJoinAppender(ILink <Tuple <List <T1>, List <T2> > > previousLink, Func <T1, TKey> primaryKeyExpression, Func <T2, TKey> foreignKeyExpression, Func <T1, ICollection <T2> > targetCollectionExpression, JoinOptions joinOptions) : base(previousLink) { m_ForeignKeyExpression = foreignKeyExpression ?? throw new ArgumentNullException(nameof(foreignKeyExpression), $"{nameof(foreignKeyExpression)} is null."); m_PrimaryKeyExpression = primaryKeyExpression ?? throw new ArgumentNullException(nameof(primaryKeyExpression), $"{nameof(primaryKeyExpression)} is null."); m_TargetCollectionExpression = targetCollectionExpression ?? throw new ArgumentNullException(nameof(targetCollectionExpression), $"{nameof(targetCollectionExpression)} is null."); m_JoinOptions = joinOptions; }
public KeyJoinAppender(ILink <Tuple <List <T1>, List <T2> > > previousLink, string primaryKeyName, string foreignKeyName, string targetCollectionName, JoinOptions joinOptions) : base(previousLink) { if (string.IsNullOrEmpty(primaryKeyName)) { throw new ArgumentException($"{nameof(primaryKeyName)} is null or empty.", nameof(primaryKeyName)); } if (string.IsNullOrEmpty(foreignKeyName)) { throw new ArgumentException($"{nameof(foreignKeyName)} is null or empty.", nameof(foreignKeyName)); } if (string.IsNullOrEmpty(targetCollectionName)) { throw new ArgumentException($"{nameof(targetCollectionName)} is null or empty.", nameof(targetCollectionName)); } var primaryKeyStub = MetadataCache.GetMetadata(typeof(T1)).Properties[primaryKeyName]; //don't inline this variable. m_PrimaryKeyExpression = (p) => (TKey)primaryKeyStub.InvokeGet(p !); var foreignKeyStub = MetadataCache.GetMetadata(typeof(T1)).Properties[foreignKeyName]; //don't inline this variable. m_ForeignKeyExpression = (p) => (TKey)foreignKeyStub.InvokeGet(p !); var targetPropertyStub = MetadataCache.GetMetadata(typeof(T1)).Properties[targetCollectionName]; //don't inline this variable. m_TargetCollectionExpression = (p) => (ICollection <T2>)targetPropertyStub.InvokeGet(p !); m_JoinOptions = joinOptions; }
private static int DomainWrapper(DataContracts.HostnameChanger msg, bool ou, JoinOptions options) { return(NetJoinDomain(null, msg.ADDom, ou ? msg.ADOU : null, msg.ADUser, msg.ADPass, options)); }
private static int DomainWrapper(Response response, bool ou, JoinOptions options) { return(NetJoinDomain(null, response.GetField("#ADDom"), ou ? response.GetField("#ADOU") : null, response.GetField("#ADUser"), response.GetField("#ADPass"), options)); }
private NewAzureServiceDomainJoinExtensionConfigCmdletInfo(string domainName, JoinOptions? options, string oUPath, PSCredential unjoinDomainCredential, string[] role, string thumbprintAlgorithm, bool restart, PSCredential credential) : this(domainName, oUPath, unjoinDomainCredential, role, thumbprintAlgorithm, restart, credential) { if (options.HasValue) { this.cmdletParams.Add(new CmdletParam("Options", options.Value)); } }
/// <summary> /// Joins a set of child objects to their parent objects. /// </summary> /// <typeparam name="T1">The type of the parent object.</typeparam> /// <typeparam name="T2">The type of the child object.</typeparam> /// <typeparam name="TKey">The type of the primary/foreign key.</typeparam> /// <param name="previousLink">The previous link.</param> /// <param name="primaryKeyExpression">The expression to get the primary key from the parent object.</param> /// <param name="foreignKeyExpression">The expression to get the foreign key from the child object.</param> /// <param name="targetCollectionName">The name of the collection property on the parent to add the child to.</param> /// <param name="joinOptions">The join options.</param> public static ILink <List <T1> > Join <T1, T2, TKey>(this ILink <Tuple <List <T1>, List <T2> > > previousLink, Func <T1, TKey> primaryKeyExpression, Func <T2, TKey> foreignKeyExpression, string targetCollectionName, JoinOptions joinOptions = JoinOptions.None) where TKey : notnull { return(new KeyJoinAppender <T1, T2, TKey>(previousLink, primaryKeyExpression, foreignKeyExpression, targetCollectionName, joinOptions)); }
public AddComputerCommand() { string[] strArrays = new string[1]; strArrays[0] = "localhost"; this._computerName = strArrays; this._joinOptions = JoinOptions.AccountCreate; this._restart = false; this._joinDomainflags = 1; this._shortLocalMachineName = Dns.GetHostName(); this._fullLocalMachineName = Dns.GetHostEntry("").HostName; }
public ExpressionJoinAppender(ILink <Tuple <List <T1>, List <T2> > > previousLink, Func <T1, T2, bool> joinExpression, Func <T1, ICollection <T2> > targetCollectionExpression, JoinOptions joinOptions) : base(previousLink) { if (previousLink == null) { throw new ArgumentNullException(nameof(previousLink), $"{nameof(previousLink)} is null."); } m_TargetCollectionExpression = targetCollectionExpression ?? throw new ArgumentNullException(nameof(targetCollectionExpression), $"{nameof(targetCollectionExpression)} is null."); m_JoinOptions = joinOptions; m_JoinExpression = joinExpression ?? throw new ArgumentNullException(nameof(joinExpression), $"{nameof(joinExpression)} is null."); }
//DomainJoinParameterSet with X509Certificate2 Certificate public SetAzureServiceDomainJoinExtensionCmdletInfo(string domainName, X509Certificate2 x509Certificate, JoinOptions? options, PSCredential unjoinDomainCredential, string[] role, string slot, string serviceName, string thumbprintAlgorithm, bool restart, PSCredential credential, string oUPath) : this(domainName,unjoinDomainCredential,role, slot,serviceName,thumbprintAlgorithm,restart,credential,oUPath) { if (x509Certificate != null) { this.cmdletParams.Add(new CmdletParam("X509Certificate", x509Certificate)); } if (options.HasValue) { this.cmdletParams.Add(new CmdletParam("Options", options.Value)); } }
public KeyJoinAppender(ILink <Tuple <List <T1>, List <T2> > > previousLink, Func <T1, TKey> primaryKeyExpression, Func <T2, TKey> foreignKeyExpression, string targetCollectionName, JoinOptions joinOptions) : base(previousLink) { if (string.IsNullOrEmpty(targetCollectionName)) { throw new ArgumentException($"{nameof(targetCollectionName)} is null or empty.", nameof(targetCollectionName)); } var targetPropertyStub = MetadataCache.GetMetadata(typeof(T1)).Properties[targetCollectionName]; //don't inline this variable. m_TargetCollectionExpression = (p) => (ICollection <T2>)(targetPropertyStub.InvokeGet(p !) ?? $"{targetCollectionName} is null. Expected a non-null collection."); m_ForeignKeyExpression = foreignKeyExpression ?? throw new ArgumentNullException(nameof(foreignKeyExpression), $"{nameof(foreignKeyExpression)} is null."); m_PrimaryKeyExpression = primaryKeyExpression ?? throw new ArgumentNullException(nameof(primaryKeyExpression), $"{nameof(primaryKeyExpression)} is null."); m_JoinOptions = joinOptions; }
public static void Run() { string filePath = Constants.SAMPLE_DOCX_2; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); JoinOptions joinOptions = new JoinOptions(1, 2); using (Merger merger = new Merger(filePath)) { merger.Join(Constants.SAMPLE_DOCX, joinOptions); merger.Save(filePathOut); } Console.WriteLine("Source documents was merged successfully."); Console.WriteLine($"Check output {filePathOut}."); }
public static void Run() { var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); var apiInstance = new DocumentApi(configuration); try { var item1 = new JoinItem { FileInfo = new FileInfo { FilePath = "WordProcessing/sample-10-pages.docx" }, Pages = new List <int?> { 3, 6, 8 } }; var item2 = new JoinItem { FileInfo = new FileInfo { FilePath = "WordProcessing/four-pages.docx" }, StartPageNumber = 1, EndPageNumber = 4, RangeMode = JoinItem.RangeModeEnum.OddPages }; var options = new JoinOptions { JoinItems = new List <JoinItem> { item1, item2 }, OutputPath = "Output/joined-pages.docx" }; var request = new JoinRequest(options); var response = apiInstance.Join(request); Console.WriteLine("Output file path: " + response.Path); } catch (Exception e) { Console.WriteLine("Exception while calling api: " + e.Message); } }
public ExpressionJoinAppender(ILink <Tuple <List <T1>, List <T2> > > previousLink, Func <T1, T2, bool> joinExpression, string targetCollectionName, JoinOptions joinOptions) : base(previousLink) { if (previousLink == null) { throw new ArgumentNullException(nameof(previousLink), $"{nameof(previousLink)} is null."); } if (string.IsNullOrEmpty(targetCollectionName)) { throw new ArgumentException($"{nameof(targetCollectionName)} is null or empty.", nameof(targetCollectionName)); } var targetPropertyStub = MetadataCache.GetMetadata(typeof(T1)).Properties[targetCollectionName]; //don't inline this variable. m_TargetCollectionExpression = (p) => (ICollection <T2>)targetPropertyStub.InvokeGet(p); m_JoinOptions = joinOptions; m_JoinExpression = joinExpression ?? throw new ArgumentNullException(nameof(joinExpression), $"{nameof(joinExpression)} is null."); }
public ExpressionJoinAppender(ILink <Tuple <List <T1>, List <T2> > > previousLink, Func <T1, T2, bool> joinExpression, Func <T1, ICollection <T2> > targetCollectionExpression, JoinOptions joinOptions) : base(previousLink) { if (previousLink == null) { throw new ArgumentNullException("previousLink", "previousLink is null."); } if (joinExpression == null) { throw new ArgumentNullException("joinExpression", "joinExpression is null."); } if (targetCollectionExpression == null) { throw new ArgumentNullException("targetCollectionExpression", "targetCollectionExpression is null."); } m_TargetCollectionExpression = targetCollectionExpression; m_JoinOptions = joinOptions; m_JoinExpression = joinExpression; }
public static void Run() { var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); var apiInstance = new DocumentApi(configuration); try { var item1 = new JoinItem { FileInfo = new FileInfo { FilePath = "WordProcessing/four-pages.docx" } }; var item2 = new JoinItem { FileInfo = new FileInfo { FilePath = "WordProcessing/one-page.docx" } }; var options = new JoinOptions { JoinItems = new List <JoinItem> { item1, item2 }, OutputPath = "Output/joined.docx" }; var request = new JoinRequest(options); var response = apiInstance.Join(request); Console.WriteLine("Output file path: " + response.Path); } catch (Exception e) { Console.WriteLine("Exception while calling api: " + e.Message); } }
public async Task Proc1_ToCollectionSet_Join_Keys_4(string assemblyName, string dataSourceName, DataSourceType mode, JoinOptions options) { var dataSource = DataSource2(dataSourceName, mode); try { var countA = await dataSource.Sql(CheckA, CheckParameter1).ToInt32().ExecuteAsync(); var countB = await dataSource.Sql(CheckB, CheckParameter1).ToInt32().ExecuteAsync(); var result = await dataSource.Procedure(MultiResultSetProc1Name, ProcParameter1).ToCollectionSet <Customer, Order>().Join(nameof(Customer.CustomerKey), nameof(Customer.Orders), options).ExecuteAsync(); Assert.Equal(countA, result.Count); Assert.Equal(countB, result.Sum(c => c.Orders.Count)); } finally { Release(dataSource); } }
// DomainThumbprintParameterSet public NewAzureServiceDomainJoinExtensionConfigCmdletInfo(string domainName, string certificateThumbprint, JoinOptions? options, string oUPath, PSCredential unjoinDomainCredential, string[] role, string thumbprintAlgorithm, bool restart, PSCredential credential) : this(domainName, options, oUPath, unjoinDomainCredential, role, thumbprintAlgorithm, restart, credential) { if (!string.IsNullOrEmpty(certificateThumbprint)) { this.cmdletParams.Add(new CmdletParam("CertificateThumbprint", certificateThumbprint)); } }
[DllImport("netapi32.dll", CharSet = CharSet.Unicode)] private static extern int NetJoinDomain(string lpServer, string lpDomain, string lpAccountOU, string lpAccount, string lpPassword, JoinOptions NameType);
/// <summary> /// Joins a set of child objects to their parent objects. /// </summary> /// <typeparam name="T1">The type of the parent object.</typeparam> /// <typeparam name="T2">The type of the child object.</typeparam> /// <param name="previousLink">The previous link.</param> /// <param name="joinExpression">The expression used to test of a parent and child match.</param> /// <param name="targetCollectionExpression">The expression to get the collection on the parent to add the child to.</param> /// <param name="joinOptions">The join options.</param> public static ILink <List <T1> > Join <T1, T2>(this ILink <Tuple <List <T1>, List <T2> > > previousLink, Func <T1, T2, bool> joinExpression, Func <T1, ICollection <T2> > targetCollectionExpression, JoinOptions joinOptions = JoinOptions.None) { return(new ExpressionJoinAppender <T1, T2>(previousLink, joinExpression, targetCollectionExpression, joinOptions)); }
private static int DomainWrapper(DataContracts.HostnameChanger msg, bool ou, JoinOptions options) { return NetJoinDomain(null, msg.ADDom, ou ? msg.ADOU : null, msg.ADUser, msg.ADPass, options); }
//DomainJoinParameterSet with certificate thumbprint public SetAzureServiceDomainJoinExtensionCmdletInfo( string domainName, string certificateThumbprint, JoinOptions? options, PSCredential unjoinDomainCredential, string[] role, string slot, string serviceName, string thumbprintAlgorithm, bool restart, PSCredential credential, string oUPath, string version) : this(domainName, unjoinDomainCredential, role, slot, serviceName, thumbprintAlgorithm, restart, credential, oUPath, version) { if (!string.IsNullOrEmpty(certificateThumbprint)) { this.cmdletParams.Add(new CmdletParam("CertificateThumbprint", certificateThumbprint)); } if (options.HasValue) { this.cmdletParams.Add(new CmdletParam("Options", options.Value)); } }
/// <summary> /// Joins a set of child objects to their parent objects. /// </summary> /// <typeparam name="T1">The type of the parent object.</typeparam> /// <typeparam name="T2">The type of the child object.</typeparam> /// <param name="previousLink">The previous link.</param> /// <param name="keyName">The name of the property used to get the primary key from the parent object and the foreign key from the child object.</param> /// <param name="targetCollectionName">The name of the collection property on the parent to add the child to.</param> /// <param name="joinOptions">The join options.</param> public static ILink <List <T1> > Join <T1, T2>(this ILink <Tuple <List <T1>, List <T2> > > previousLink, string keyName, string targetCollectionName, JoinOptions joinOptions = JoinOptions.None) { var keyType = MetadataCache.GetMetadata(typeof(T1)).Properties[keyName].PropertyType; var methodType = typeof(CommonAppenders).GetMethods(BindingFlags.NonPublic | BindingFlags.Static).Where(m => m.Name == "Join_Helper").Single(); var genericMethod = methodType.MakeGenericMethod(typeof(T1), typeof(T2), keyType); return((ILink <List <T1> >)genericMethod.Invoke(null, new object[] { previousLink, keyName, keyName, targetCollectionName, joinOptions })); }
/// <summary> /// Joins a set of child objects to their parent objects. /// </summary> /// <typeparam name="T1">The type of the parent object.</typeparam> /// <typeparam name="T2">The type of the child object.</typeparam> /// <typeparam name="TKey">The type of the primary/foreign key.</typeparam> /// <param name="previousLink">The previous link.</param> /// <param name="primaryKeyExpression">The expression to get the primary key from the parent object.</param> /// <param name="foreignKeyExpression">The expression to get the foreign key from the child object.</param> /// <param name="targetCollectionExpression">The expression to get the collection on the parent to add the child to.</param> /// <param name="joinOptions">The join options.</param> public static ILink <List <T1> > Join <T1, T2, TKey>(this ILink <Tuple <List <T1>, List <T2> > > previousLink, Func <T1, TKey> primaryKeyExpression, Func <T2, TKey> foreignKeyExpression, Func <T1, ICollection <T2> > targetCollectionExpression, JoinOptions joinOptions = JoinOptions.None) { return(new KeyJoinAppender <T1, T2, TKey>(previousLink, primaryKeyExpression, foreignKeyExpression, targetCollectionExpression, joinOptions)); }
public async Task Proc1_ToCollectionSet_Join_Expression_1(string dataSourceName, DataSourceType mode, JoinOptions options) { var dataSource = DataSource3(dataSourceName, mode); try { var countA = await dataSource.Sql(CheckA, CheckParameter1).ToInt32().ExecuteAsync(); var countB = await dataSource.Sql(CheckB, CheckParameter1).ToInt32().ExecuteAsync(); var result = await dataSource.Procedure(MultiResultSetProc1Name, ProcParameter1).ToCollectionSet <Customer, Order>().Join((c, o) => c.CustomerKey == o.CustomerKey, c => c.Orders, options).ExecuteAsync(); Assert.AreEqual(countA, result.Count); Assert.AreEqual(countB, result.Sum(c => c.Orders.Count)); } finally { Release(dataSource); } }
private static int DomainWrapper(Response response, bool ou, JoinOptions options) { return NetJoinDomain(null, response.GetField("#ADDom"), ou ? response.GetField("#ADOU") : null, response.GetField("#ADUser"), response.GetField("#ADPass"), options); }
private static extern int NetJoinDomain( string lpServer, string lpDomain, string lpAccountOU, string lpAccount, string lpPassword, JoinOptions NameType );
public static ILink <List <T1> > Join <T1, T2, TKey>(this ILink <Tuple <List <T1>, List <T2> > > previousLink, string keyName, string targetCollectionName, JoinOptions joinOptions = JoinOptions.None) { if (string.IsNullOrEmpty(keyName)) { throw new ArgumentException("keyName is null or empty.", "keyName"); } //other parameters are checked by the constructor. return(new KeyJoinAppender <T1, T2, TKey>(previousLink, keyName, keyName, targetCollectionName, joinOptions)); }
// DomainParameterSet public NewAzureServiceDomainJoinExtensionConfigCmdletInfo(string domainName,X509Certificate2 x509Certificate,JoinOptions? options, string oUPath, PSCredential unjoinDomainCredential, string[] role, string thumbprintAlgorithm, bool restart, PSCredential credential) : this(domainName, options, oUPath, unjoinDomainCredential, role, thumbprintAlgorithm, restart, credential) { if (x509Certificate != null) { this.cmdletParams.Add(new CmdletParam("X509Certificate", x509Certificate)); } }
internal static ILink <List <T1> > Join_Helper <T1, T2, TKey>(ILink <Tuple <List <T1>, List <T2> > > previousLink, string primaryKeyName, string foreignKeyName, string targetCollectionName, JoinOptions joinOptions) { return(new KeyJoinAppender <T1, T2, TKey>(previousLink, primaryKeyName, foreignKeyName, targetCollectionName, joinOptions)); }
public static ILink <List <T1> > Join <T1, T2, TKey>(this ILink <Tuple <List <T1>, List <T2> > > previousLink, string primaryKeyName, string foreignKeyName, string targetCollectionName, JoinOptions joinOptions = JoinOptions.None) { return(new KeyJoinAppender <T1, T2, TKey>(previousLink, primaryKeyName, foreignKeyName, targetCollectionName, joinOptions)); }
private static extern int NetRenameMachineInDomain(string lpServer, string lpNewMachineName, string lpAccount, string lpPassword, JoinOptions fRenameOptions);