What are the Basic different between MEF for framework 3.5 and MEFfor framework 4.0? - mef

I try to below link for window application with MEF
http://geekswithblogs.net/malisancube/archive/2009/05/26/managed-extensibility-framework-101---a.aspx
it's work good in Framework 3.5 but when i try to develop same code for framework 4.0
not able to find below function
return container.GetExportedObject<Form1>();
please give me some properly example for window application with MEF where my container all the Usercontrols on Form

MEF was being developed pre-.NET 4.0 but it became an official part of the framework from .NET 4.0 forwards. The API you are looking for is actually the ExportProvider.GetExportedValue<T> method which CompositionContainer inherits from:
return container.GetExportedValue<Form1>();
GetExportedObject was renamed GetExportedValue, and it occurred with MEF preview 6, which means that blog post was actually based on quite an early revision of MEF.

Related

INodeServices is obsolete: Use Microsoft.AspNetCore.SpaServices.Extensions

We've recently upgraded from ASP.NET Core 1.0 to 3.1.
And in our code we're using the interface INodeServices and call its InvokeAsync method to activate some JavaScript library. After the upgrade to Core 3.1 the compiler complains that INodeServices is obsolete and should be replaced with 'Microsoft.AspNetCore.SpaServices.Extensions', but I couldn't find any type within this library that I could use instead of INodeServices, and I also coudn't find any documentation about it. What is the replacement for INodeServices.InvokeAsync in ASP.NET Core 3.1?
Thanks,
ashilon
Consider using this library instead https://github.com/JeringTech/Javascript.NodeJS
For more detailed informations and to see what other people did, i suggest you give a look at this thread https://github.com/dotnet/AspNetCore/issues/12890

Framework with embedded frameworks

I am building private framework CustomSDK.framework that uses embedded frameworks inside like PKHUD.framework. The issue is that client app that uses my framework doesn't see frameworks that are embedded in my framework such as
CustomSDK.framework -> PKHUD.framework
It gives error Missing required module 'PKHUD'
How can I fix it?
Thanks

ASP.NET Dynamic Data Entities Web Project Broken

Can anybody get ASP.NET Dynamic Data Entities Web project working under EF 6.0.2 and .NET 4.5 in Visual Studio 2013?
I find problems in ManyToMany_Edit.ascx.cs and Global.asax.cs all relating to the switch in namespace for ObjectContext. Changing the using statements in the generated files is not enough. In other words, following this guide is not enough.
System.Web.DynamicData.dll doesn't seem to be aware of System.Data.Entity.Core.Objects.ObjectContext.
Have you read this post? http://blogs.msdn.com/b/webdev/archive/2014/02/28/announcing-the-release-of-dynamic-data-provider-and-entitydatasource-control-for-entity-framework-6.aspx , this works for me

What's the .NET 4.5 equivalent to UserNameWSTrustBinding?

I am converting a active profile STS to the new .NET 4.5 System.IdentityModel framework. My code using the UserNameWSTrustBinding which doesn't seem to exist in the new framework. Any suggestions.
Although this is an old question, I couldn't find any non-third-party answer on the internet, so here it is:
To replace UserNameWSTrustBinding in .NET 4.5, use the following:
var binding = new WS2007HttpBinding(SecurityMode.{what it was before});
binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
I ported the WCF bindings to thinktecture identity model:
https://github.com/thinktecture/Thinktecture.IdentityModel.45
I also had a hard time finding something that for .NET 4.5 that was not a third party library. But I came across this link for code you can include in your project.

LinkBuilder.BuildUrlFromExpression not working anymore in .Net 4 / VS 2010?

I recently migrating my ASP.Net MVC 1 application from VS.Net 2008 / C# 3.5 to VS.NET 2010 / C# 4.0.
I massively used a builder to get URL strings from the strongly typed calls.
It looks like this :
// sample call :
string toSamplePage = Url.To<SampleController>(c => c.Page(parameter1, parameter2));
the code is added as an extension to the default UrlHelper :
public static string To<Tcontroller>(UrlHelper helper, Expression<Action<Tcontroller>> action) where Tcontroller : Controller
{
// based on Microsoft.Web.Mvc.dll LinkBuilder
return LinkBuilder.BuildUrlFromExpression<Tcontroller>(helper.RequestContext, helper.RouteCollection, action);
}
The only problem of this, is the reference to Microsoft.Web.Mvc dll, but the gain in readability was worth it.
Problem : it does not work anymore, return (null) whatever the parameters.
Questions :
is there a better way now to build links from an expression ?
(yes I tried to google it without success)
is there a trick to have the former LinkBuilder.BuildUrlFromExpression works ?
I tried to recompile it into C# 4.0, but the problem is that it implies working on my own compilated version of System.Web.Mvc which is not an option.
I'm currently trying to migrate to MVC 2 but I still have issues...
Waiting for your suggestions...
Our team overcame this identical issue by referencing System(Microsoft).Web.Mvc 2.0.0.0 statically in our libraries folder, as opposed to a GAC reference. This permitted us to continue working with MVC 1.0.0.0 projects and also gave us the downstream benefit of not having to install MVC 2 on our servers.
Oki, I found the problem.
I had assemblies versioning problems.
After rebuilding Microsoft.Web.Mvc + unistalling MVC 1 + refreshing all references it finally worked again.
It sucks because I still need MVC 1 for others projects, but at least my main problem has been solved.
To developpers new to the MVC framework : consider starting directly with MVC 2 / VS.Net 2010 / C# 4.0