NET 4.7 HttpWebClientProtocol.Proxy property in NET 6? - soap

Is there an alternative to HttpWebClientProtocol.Proxy property available up to NET 4.8 according to this. I have a project in NET6 that makes a SOAP call and that works. But it needs to work using proxy settings as well, as it was in old NET code which we are replacing. But I cannot find alternative to that property.
Old auto generated code class used to inherit from SoapHttpClientProtocol which inherits HttpWebClientProtocol so the property Proxy could be set.
My current class inherits: System.ServiceModel.ClientBase<...
Is this caused by some setting when connecting the service or NET 6 does not have this property at all? I can't believe it, but can't find it either..
Many thanks for any help

Related

Setting SMBIOSAssetTag in a WMIObject via Powershell without a utility

I'm working with a Lenovo Thinkpad and I'm trying to set the asset tag in Powershell without using Lenovo's WinAIA.exe utility due to restrictions at work (wouldn't be able to access Windows. We would be running everything before we got into Windows Setup via Powershell), and I'm not sure how to go about this. Essentially, the property "SMBIOSAssetTag" (from the WMI class win32_SystemEnclosure) is ReadOnly, and I cannot get around this. I did triple check to make sure that Lenovo does not have its own namespace, and while using the Powershell Module "LenovoBIOS" I didn't see anything that could help me achieve this goal (unless I'm blind and totally missed it). Is there any way to go about this? I've also tried modifying the ReadOnly property of the SMBIOSAssetTag property, but I couldn't get that to work. I'd love any and all feedback. If there is any extra information needed, I'd be happy to help as well.
You don't. The property is defined as read-only in the MOF spec by design.
You're talking about writing to the SMBIOS information, which is an operation specific to your motherboard's OEM. It's up to your OEM to determine the data structure and storage method of the SMBIOS information, and the SMBIOS standard does not provide a standard write method the same way that there is a standard read method.

how to obtain the information about System Configuration in RCP 4

I am trying to obtain information about the system configuration in RCP 4 application. I got a link RCP3 System Configuration which implemented in RCP3 for getting the system configuration. WorkbenchMessages properties and WorkbenchPlugin are used to get the system configuration in RCP3 application but in RCP4 those are not available. How can I implement to get the system configuration?
The ConfigurationInfo class you reference is using the org.eclipse.ui.systemSummarySection extension point and calling the ISystemSummarySection interfaces it defines to get the system summary.
This extension point and the ISystemSummarySection interface do not exist in a plain e4 app so this information is not available using this code.
You may be able to get some of the information by looking at the individual classes that implement ISystemSummarySection and copying the code for those parts that don't use 3.x compatibility mode classes.
For example the ConfigurationLogDefaultSection class just uses System.getProperties() to list the system properties section.

EF6 only lazy works from loaded context data

Using EF 6 rc 1
Code first
Lazy loading is enabled and proxy generation is allowed (defaults).
When attempting to access navigation properties, I am finding that:
- if the referenced object was already loaded into the DbContext in some manner, the navigation property will be populated
- if the referenced object was not already loaded, the navigation property will remain null. No query attempt is made to the SQL Server DB.
This applies to collections and objects. In all cases, I have verified that the navigation properties are marked virtual.
Is this expected behaviour? I have scroured every article I could find but have found no description of this (please provide links). If not expected behaviour, what could I be doing wrong?
Thank you!
EDIT:
Because I can't post the classes I have, I've tried to reproduce this into a simple example I would be comfortable posting. The simple example, however, works as expected. I have noticed one major difference between the working example and the non-working: my non-working application produces entities that are NOT proxies. This, even though proxy generation is allowed, and I am retrieving these objects from a new context (NOT the context they were created in). I can't post the non-working code, and there's no value in posting the working code. Theories explaining why proxy classes are not being generated would be welcome!
Turned out the reason the Proxy wrapper wasn't being created is because some of the classes had the default constructor marked internal. Simply changing them to protected allowed the Proxy to be created, which then enabled lazy loading. Though I found this to be pretty obscure it is documented here: http://msdn.microsoft.com/en-us/library/vstudio/dd468057(v=vs.100).aspx

IoC, MVC4 Web API & HttpParameterBinding/ParameterBindingAttribute

I'm using ASP.Net MVC 4 RTM Web API. I have a controller action with a parameter that I'd like to populate via custom model binding. To achieve this, I created a class that derives from System.Web.Http.Controllers.HttpParameterBinding that sets the value of this parameter. I then created an attribute class that derives from System.Web.Http.ParameterBindingAttribute which I use to decorate the parameter on my controller action.
This is all working great, my HttpParameterBinding class is populating the action parameter correctly. The problem I have is that my custom parameter binding class has a dependency that I'd like resolved via my IoC container (Unity). Is there a way to override how Web API creates HttpParameterBinding instances so that I can build up my custom binding class dependency from Unity? I was able to do something similar for a filter attribute by creating a custom filter provider that uses Unity's BuildUp method to populate dependencies, however I'm not seeing anything similar for Web API's HttpParameterBindings.
In general: to use IoC / Unity in the Web API you need to set it up seperately.
Try downloading the nuget package Unity.WebApi and see if that helps!
Take a look at this article: Parameter Binding in WebAPI
It walks through a couple different options from Converters to Binders to BinderProviders. It sounds like you may be able to write a custom ModelBinderProvider which knows how to provide your dependency. If that isn't high enough in the chain you can look at replacing the default IActionValueBinder service. It's a DefaultActionValueBinder instance, which you can extend or simply re-implement.
I also highly recommend downloading the WebAPI source code, as it's been an incredible help for these issues as I've run into them. Here's the WebAPI source code. I recommend downloading it so you can open it in VS for easy navigation.
Feel free to check out FlitBit too (It's very modular, don't let the number of packages scare you off)! I'm working on a WebAPI package for supporting FlitBit, specifically FlitBit.IoC and FlitBit.Dto. I'll add an update if I work out my IoC issue, since it's very similar to yours.

ASP.NET MVC2 IoC: Looking for an example using CastleWindsor container that works with minimum config

I am looking for an example of how to configure an ASP.NET MVC2 project to use CastleWindsor container to do IoC.
I keep running into problems setting it up, and for every problem there seems to be a solution on-line, but in the end I make so many changes and end up with such a verbose setup to get IoC working using CastleWindsor, that I thought it best to ask this question.
I am looking for the minimum configuration required in the Global.asax page, the Web.config, and if required, what other changes and extension classes are required.
I am not looking to inject into actionfilters at this stage, so just the basics. Preferably not using XML files, but doing it in .NET programatically.
Thank you in advance...
This is as basic as it gets:
Start a MVC2 project from VS2010
Download MvcContrib for MVC2 (the one that says "extra binaries")
In your project, add a reference to (all these DLLs are included in MvcContrib):
Castle.Core.dll
Castle.DynamicProxy2.dll
Castle.MicroKernel.dll
Castle.Windsor.dll
MvcContrib.dll
MvcContrib.Castle.dll
In your Application_Start(), add these lines (and whatever namespaces are needed):
var container = new WindsorContainer();
container.RegisterControllers(typeof(HomeController).Assembly);
ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(container));