How to upgrade to EntLib 5 (from 1.1) IRolesProvider doesn't exist - enterprise-library

We are upgrading from enterprise lib 1.1 to 5.0, where some of the Interface and class are not for in enterprise lib 5.0 dll reference.
ConfigurationProvider
IRolesProvider
SecurityConfigurationView
These are not working in enterprise library 5.0

Configuration was moved into .NET 2.0 so any custom configuration should be converted to use the BCL classes.
I would think that IRolesProvider would be replaced with the abstract RoleProvider class.
SecurityConfigurationView was removed between version 4.1 and version 5.0. It's just a small facade over the SecuritySettings configuration class. You could either access the SecuritySettings directly or (re)create the functionality with your own class.

Related

How to use EF Core 6.0 with an application that uses .Net Framework?

I have a situation where an application uses various component libraries. The libraries were based on .NetStandard2.0/2.1 and internally used EF Core 3.1. For various deployment and development reasons, we now want to target EF Core 6.0, which raises the following issues.
Net Core 3.1 support runs out in December 2022 so we need to move away from it.
The application uses Net Framework functionality and cannot move to Net Core.
EF Core 6.0 does not support NetStandard, only Net 6.
Changing the library that uses EF Core to target NET 6 means that components referencing it also need to reference Net 6.
Dependencies trickle down to the application that targets Net Framework and, as a result, the application no longer builds because Net Framework is not compatible Net 6.
How can the Net Framework application use the Net 6 assembly? Or, more specifically, how can a Net Framework application use libraries that internally use EF Core 6.0?
The interface between the application (Net Framework) and the one single touch point library component (Netstandard) is very well defined. Maybe Pinvoke could solve the problem? Or something simpler that I have overlooked?
Somewhat related question: NU1202 Package Microsoft.EntityFrameworkCore 6.0.3 is not compatible with netstandard2.1
Other than process to process communication between .NET Framework and .NET 6, this is not supported (for example via a Web API or similar)
As a short term solution, you can change your .Net Standard 2.0 EF Core libraries to be multi targeted to both .Net Standard 2.0 (which will reference EF Core 3.1) and .Net 6 (which will reference EF Core 6). This will let your .Net Core apps use EF Core 6, while allowing your .Net Framework apps to use the same dlls, but to be using EF Core 3.1. I realize that EF Core 3.1 support ends December 2022, but it will keep things moving.
https://learn.microsoft.com/en-us/nuget/create-packages/multiple-target-frameworks-project-file
Btw, has Microsoft even attempted to address the fact that a .Net Framework application cannot reference .Net 6, therefore it cannot use EF Core 6? This is a major issue for us, as we were sold the idea that .Net Standard could be shared between .Net Framework and .Net Core, but this has ceased to be the case since .Net Standard 2.1 was introduced, and now MS has pushed all new features, like EF Core, to .Net 6.

Set .NET Framework version for ScriptComponentProject

Is it possible to set the .NET Framework version for a ScriptComponentProject?
Currently it defaults to .NET 4, but I want it to be .NET 4.6.1
I've looked on the documentation page for ScriptComponentProject (https://www.varigence.com/Documentation/Samples/Biml/Script+Component+Project), but without any luck.
Ah, I found the answer! You need to set the Target Framework Version in your script project:
https://www.varigence.com/Documentation/Language/Element/AstComponentScriptProjectNode
And I think the available values are these:
Unspecified
Unspecified .NET Framework Version
NetFX20
.NET Framework 2.0
NetFX30
.NET Framework 3.0
NetFX35
.NET Framework 3.5
NetFX40
.NET Framework 4.0
NetFX45
.NET Framework 4.5
NetFX451
.NET Framework 4.5.1
NetFX452
.NET Framework 4.5.2
NetFX46
.NET Framework 4.6
NetFX461
.NET Framework 4.6.1
Which can be found here: https://www.varigence.com/Documentation/Api/Enum/ScriptProjectTargetFrameworkVersion
If you are using BIMLExpress 5.0.6xxx, you have probably faced the same issue.
I opened the generated .dtsx package and found that the TargetFrameworkVersion node placed inside of a separate PropertyGroup node. After I had moved it out to the first PropertyGroup of the same arrayElement node, then reopened my package in Visual Studio again, issue was gone! So you can write a script to move TargetFrameworkVersion node into the proper place for now.
Varigence support team told me that a public preview release is coming late next week which will include a fix for that (+also VS2017 support!).

Where is the "System.Composition.TypedParts.dll"?

I am trying to use the ContainerConfiguration type from the Managed Extensibility Framework (MEF). According to here, it lives in "System.Composition.TypedParts.dll" which is part of .NET Framework 4.5. But I cannot find it in Add Reference for a .NET 4.5 application.
Where can I find this DLL?
It turned out to be part of MEF 2, which needs to be installed with NuGet. It's not distributed with .NET Framework.

EF 4.3.1 with VS 2011

I need to know if it is possible to start using the latest version of EF (4.3.1) with VS 2011 without having to install these CTP components as stated here.
I had these components installed but I removed them and since then I can't add a new edmx file to .net 4 targeted project; it complains about missing reference to System.Data.Entity.
Do I need to re install VS 2011?
After I removed and reinstalled Visual Studio, I still couldn't get red of the error, so I used process monitor to log what Visual Studio is doing with System.Data.Entity as a path filter, turned out that Visual Studio was reading from
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\policy.4.0.system.data.entity v4.0_0.0.0.0__b77a5c561934e089\policy.4.0.system.data.entity.config
which had binding to the
System.Data.Entity.dll v 4.2.0.0
once I cleared the file VS was worked like charm.
The CTP uninstall left this out.
Yeah should work with no issues using .net 4, however theres a list of known issues when using .net 4.5. You dont need to re-install vs to get version 4.3.1 of entity framework, simply install it from the nuget package gallery and if you are using .net 4 it all seems to just work.
Issues listed when installing EF4.3.1 on .net 4.5 include those listed below.
Known Issues with Entity Framework 4.x and .NET Framework 4.5
Entity Framework 4.1 thru 4.3 included additional data annotations in the
System.ComponentModel.DataAnnotations namespace in the EntityFramework assembly.
In .NET 4.5 these annotations were moved to be part of the .NET Framework in the
System.ComponentModel.DataAnnotations.Schema namespace of the
System.ComponentModel.DataAnnotations.dll assembly. If you are using EF 4.x and targeting
.NET 4.5 this results in two data annotations with the same name in different assemblies.
Because the annotations in the .NET Framework are in a different namespace we were not
able to use type forwarding to avoid this conflict.
It is possible to use EF 4.x on .NET 4.5 but we recommend using the latest pre-release
version of EF 5. If you are not using the affected data annotations there is no impact
on your code. If you are using the data annotations in a C# project you can use the extern
modifier to ensure your code uses the annotations from EntityFramework.dll
(http://msdn.microsoft.com/en-us/library/e59b22c5(v=VS.80).aspx). If you use the new
annotations from the System.ComponentModel.DataAnnotations.dll assembly in .NET 4.5
they will not be processed by Code First.
The affected annotations are:
Column
ComplexType
DatabaseGenerated
DatabaseGeneratedOption
ForeignKey
InverseProperty
MaxLength
MinLength
NotMapped
Table

how .net 1.1 application can work with .net 2.0 assembly

We have old .net 1.1 project that is using a third party component. Aparently that component is not working properly with new requirements, and there is no support from the provider. Provider proposed to use new component that is working properly. The problem is that this component requires .net 2.0.
The project is big and it will be costly to move this project to 2.0.
What other alternatives we can have? How 1.1 assembly can call 2.0 assembly?
.NET 1.1 can't load .NET 2.0 assemblies, because the internal format changed. Your app will basically think that the assembly isn't a .NET assembly.
Long term, it would be a good idea to update your application to use .NET 2.0 (if not something newer, since there are multiple versions of .NET since 2.0 now). However, if that is not an option, you could create a .config file for your executable, and tell the CLR to always use .NET 2.0 when running your app. This should allow for the .NET 2.0 assembly to load, however any breaking changes between .NET 1.1 and 2.0 that your app makes use of will cause errors.