/// <summary> /// Executes the method <see cref="FluentApiFactory.AssemblyFrom(Type[], string, string, Type, bool?)"/>. /// Make sure that you have already called the method <see cref="ScanAssemblyFrom(Type)"/>. /// </summary> /// <param name="fileName">The physical file name under which the dynamic fluent API assembly will be saved.</param> /// <returns></returns> /// <exception cref="InvalidOperationException">You must first call one of the Scan methods.</exception> public FluentApiFactoryConfig Build(string fileName = null) { CheckDisposed(); try { if (_assemblyTypes == null) { ThrowScanRequired(); } _result = FluentApiFactory.AssemblyFrom(_assemblyTypes, fileName: fileName); _executed = true; if (!_result.Succeeded) { _onErrorHandler?.Invoke(_result.Error); } } catch (Exception ex) { if (_onErrorHandler == null) { throw; } _onErrorHandler?.Invoke(ex); } return(this); }
/// <summary> /// Reset the last execution configuration except for error handlers, and factory configuration options. /// The <see cref="FluentApiFactory"/>'s internal dictionary of previously created types, such as interfaces, /// proxies, and fluent API types, are also discarded. /// </summary> /// <returns></returns> public FluentApiFactoryConfig Reset() { CheckDisposed(); FluentApiFactory.Reset(); _result = null; _executed = false; _assemblyTypes = null; return(this); }