Closed yvesgoeleven closed 10 years ago
it's not even non trivial to do this, it's impossible: FileVersionRetriever is internal
Here's what the endpoint config would look like, if FileVersionRetriever weren't internal, for one of the endpoints in the videostore sample:
public class EndpointConfig : IConfigureThisEndpoint, AsA_Publisher, UsingTransport, IWantCustomInitialization { public Configure Init() { var assemblyScanner = new AssemblyScanner(); assemblyScanner.MustReferenceAtLeastOneAssembly.Add(typeof(IHandleMessages<>).Assembly); var assembliesToScan = assemblyScanner .GetScannableAssemblies() .Assemblies; var endpointName = this.GetType().Namespace ?? this.GetType().Assembly.GetName().Name; var endpointVersionToUse = FileVersionRetriever.GetFileVersion(this.GetType()); var config = Configure.With(o => { o.EndpointName(endpointName ); o.EndpointVersion(() => endpointVersionToUse); o.AssembliesToScan(assembliesToScan); o.Conventions(c => c.DefiningCommandsAs(t => t.Namespace != null && t.Namespace.StartsWith("VideoStore") && t.Namespace.EndsWith("Commands")) .DefiningEventsAs(t =>t.Namespace != null && t.Namespace.StartsWith("VideoStore") && t.Namespace.EndsWith("Events")) .DefiningMessagesAs(t =>t.Namespace != null && t.Namespace.StartsWith("VideoStore") &&t.Namespace.EndsWith("RequestResponse")) .DefiningEncryptedPropertiesAs(p => p.Name.StartsWith("Encrypted"))); }); return config; } }
@yvesgoeleven why do u need FileVersionRetriever
?
I don't know, but I just want to be able to start off with the same settings as the defaults
Talked this through with @johnsimons today we need to fix this.
On Tue, Jun 17, 2014 at 11:24 AM, Yves Goeleven notifications@github.com wrote:
I don't know, but I just want to be able to start off with the same settings as the defaults
— Reply to this email directly or view it on GitHub https://github.com/Particular/NServiceBus/issues/2179#issuecomment-46285243 .
@johnsimons did you talk to @SimonCropp ?
done
@andreasohlund "done"?? was there a commit for this? what was the resolution?
This was fixed as part of the refactoring done to the configuration story, but this was also raised as part of testing the first cut of the v5 API so it doesn't really belong to the v5 milestone
The default implementation for configure.With uses private fields to initialize itself, https://github.com/Particular/NServiceBus/blob/develop/src/NServiceBus.Hosting.Windows/GenericHost.cs#L128, but if you have to implement IWantCustomInitialization as a user (which is likely as you have to do it now to set endpointname or conventions as well) you cannot access these and you're on your own to figure out what it should be.