/// <summary> /// Returns a new instance of a <see cref="DomainObject"/> with the supplied constructor arguments in the given <see cref="ClientTransaction"/>. /// </summary> /// <param name="clientTransaction">The <see cref="ClientTransaction"/>.</param> /// <param name="domainObjectType">The <see cref="Type"/> of the <see cref="DomainObject"/> to be created.</param> /// <param name="constructorParameters">A <see cref="ParamList"/> encapsulating the parameters to be passed to the constructor. Instantiate this /// by using one of the <see cref="ParamList.Create{A1,A2}"/> methods.</param> /// <returns>A new domain object instance.</returns> /// <remarks> /// <para> /// Objects created by this factory method are not directly instantiated; instead a proxy is dynamically created, which will assist in /// management tasks at runtime. /// </para> /// <para> /// This method should only be used by infrastructure code, ordinary code should use <see cref="DomainObject.NewObject{T}(ParamList)"/>. /// </para> /// <para>For more information, also see the constructor documentation (<see cref="DomainObject"/>).</para> /// </remarks> /// <exception cref="ArgumentNullException">One of the parameters is <see langword="null" />.</exception> /// <exception cref="MappingException">The <paramref name="domainObjectType"/> parameter does not specify a domain object type with mapping information.</exception> /// <exception cref="ArgumentException">The type <paramref name="domainObjectType"/> cannot be extended to a proxy, for example because it is sealed /// or abstract and non-instantiable.</exception> /// <exception cref="MissingMethodException">The <paramref name="domainObjectType"/> does not implement the required constructor (see Remarks /// section). /// </exception> public static DomainObject NewObject(ClientTransaction clientTransaction, Type domainObjectType, ParamList constructorParameters) { ArgumentUtility.CheckNotNull("clientTransaction", clientTransaction); ArgumentUtility.CheckNotNull("domainObjectType", domainObjectType); ArgumentUtility.CheckNotNull("constructorParameters", constructorParameters); return(clientTransaction.NewObject(domainObjectType, constructorParameters)); }