Eazfuscator.NET. Disable sealing - eazfuscator

I need to disable Sealing of Terminal Classes feature. But I cannot find which name I should use for ObfuscationAttribute.
I tried this:
[Obfuscation(Feature = "sealing", Exclude = true)]
class MyClass {
}
But it does not work.
Where I can find names for all Eazfuscator.NET features?

Use auto-sealing instead of sealing:
[Obfuscation(Feature = "auto-sealing", Exclude = true)]
class MyClass
{
}
The official support for sealing alternative name will be available since Eazfuscator.NET 2019.4+.

Related

ABP does not automatically use custom mapper class

I have created a custom mapper class as below but ABP does not automatically register and use it while mapping.
https://docs.abp.io/en/abp/4.4/Object-To-Object-Mapping#iobjectmapper-tsource-tdestination-interface
Sorry for less detail, i have added some below,
I have found that mycustommapperclass's interface different from my object mapper,
should I implement for all container types?
public class HierachyItemCustomMapper : IObjectMapper<HierachyItem, HierachyItemDto>, ITransientDependency
{
and my usage like
var nodeListDto = ObjectMapper.Map<IEnumerable<HierachyItem>, IEnumerable<HierachyItemDto>>(nodeList);
How can i handle this?
Obviously I am looking for a result instead of foreach iterator loop.
Edit:
it have found that it is known issue as below
https://github.com/abpframework/abp/issues/94
I've tried just before and it seems it works as expected.
This is my HierachyItemCustomMapper class which I've created in the Application layer. (It should be created in the Application layer.)
public class HierachyItemCustomMapper : IObjectMapper<HierachyItem, HierachyItemDto>, ITransientDependency
{
public HierachyItemDto Map(HierachyItem source)
{
return new HierachyItemDto
{
Name = source.Name
};
}
public HierachyItemDto Map(HierachyItem source, HierachyItemDto destination)
{
destination.Name = source.Name;
return destination;
}
}
I've just added a property named Name in my both classes (HierachyItem and HierachyItemDto) to test.
You probably didn't define it in the Application layer and that cause the problem. Can you check it?
It's simple , your defination is wrong
it should be like that
public class HierachyItemCustomMapper : IObjectMapper<IEnumerable<HierachyItem>,
IEnumerable<HierachyItemDto>>, ITransientDependency {}
as it searches for exact defination match , and if you want to add also capability of using ObjectMapper.Map<HierachyItem, HierachyItemDto>
you can make your custom mapper defination like that
public class HierachyItemCustomMapper : IObjectMapper<IEnumerable<HierachyItem>,
IEnumerable<HierachyItemDto>>, IObjectMapper<HierachyItem, HierachyItemDto> ,
ITransientDependency {}
and you will implement both
good luck

How to read extentions with depth greater than one from custom gradle plugin?

I would like to create a custom extension with some dynamic name as
myExt {
aNameChoosenByUser{
firstname = 'toto'
age = 2
}
aNameChoosenByUser2{
firstname = 'tata'
age = 3
}
}
I use usually:
project.extensions.create("myExt", APluginExtension)
but here I do not know when I create the plugin "aNameChoosenByUser", "aNameChoosenByUser2" . I would like let user to define it. And After iterate as it was a HashMap<String,APluginExtension> .
I do not want to define "aNameChoosenByUser" into my plugin.
It is possible to do it with groovy/gradle ?
thanks
What you want to create is a NamedDomainObjectContainer which can be done by calling Project.container() and passing a type. In this case, rather than defining a type for you extension, you'll want to define a type for the model object of the container.
project.extensions.create('myExt', project.container(User.class))
public class User {
String firstname;
String age;
}

Dynamically referencing a Service using Felix annotations

I have created an interface which two different services are implementing.
Consider interface is named as CheckReference and two different classes CheckReferenceImpl1 and CheckReferencImpl2 are implementing it.
#Component
#Service(value = CheckReference.class)
#Property(name = "domain", value = "ref1")
public class CheckReferenceImpl1 implements CheckReference
And another one,
#Component
#Service(value = CheckReference.class)
#Property(name = "domain", value = "ref2")
public class CheckReferenceImpl2 implements CheckReference
Now I want to dynamically load the implementation depending on my need using #Reference annotation dynamically.
So , In a check condition
public class LoadReference {
#Reference
CheckReference checkReference
if(check) {
// load checkReferencImpl1
} else {
// load checkReferenceImpl2
}
}
Also I know that I can use target property to load specific implemenation. But that is static way.
But in order to do this dynamically , Not able to relate from specifications and tutorials how should I do this ??
First, you have to make LoadReference a #Component, so that it is managed by the SCR (otherwise #Reference won't work either). Next, you have to provide a configuration for it using the Configuration Admin Service. In this configuration, you can provide a filter for the reference by providing a property with the name REFERENCE_NAME.target:
checkReference.target = FILTER_EXPRESSION
FILTER_EXPRESSION is a standard LDAP-expression used in OSGi-filters. Due to property propagation, this configuration property will be propagated to the service-component, and it will be used when selecting a target service for checkReference. This does not require any code for checking the condition in LoadReference.
Have you looked at ComponentContext.locateService?

EF 5 Re-Use entity configuration

I'm trying to re-use some of the model configurations on several entities that implements a interface.
Check this code:
public static void ConfigureAsAuditable<T>(this EntityTypeConfiguration<T> thisRef)
where T : class, IAuditable
{
thisRef.Property(x => x.CreatedOn)
.HasColumnName("utctimestamp")
.IsRequired();
thisRef.Property(x => x.LastUpdate)
.HasColumnName("utclastchanged")
.IsRequired();
} // ConfigureAsAuditable
as you can see I'm trying to call the extension method "ConfigureAsAuditable" on my onmodelcreating method like this:
EntityTypeConfiguration<Account> conf = null;
conf = modelBuilder.Entity<Account>();
conf.ToTable("dbo.taccount");
conf.ConfigureAsAuditable();
When debugging i get this exception:
The property 'CreatedOn' is not a declared property on type
'Account'. Verify that the property has not been explicitly excluded
from the model by using the Ignore method or NotMappedAttribute data
annotation. Make sure that it is a valid primitive property.
Thanks in advance :)
PD:
I'm using EF 5-rc, VS 2011 and .NET Framework 4.5
I think a better approach would be to implement your own derived version of EntityTypeConfiguration. For example:
public class MyAuditableConfigurationEntityType<T> : EntityTypeConfiguration<T>
where T : class, IAuditable{
public bool IsAuditable{get;set;}
}
Then, when building your model, use that new type:
var accountConfiguration = new MyAuditableConfigurationEntityType<Account>();
accountConfiguration.IsAuditable = true; // or whatever you need to set
accountConfiguration.(HasKey/Ignore/ToTable/Whatever)
modelBuilder.Configurations.Add(accountConfiguration);

XmlSerializer, XmlArray with dynamic content... how?

To start: This is also for REST deserialiaztion, so a custom XmlSerializer is out of the question.
I have a hjierarchy of classes that need to be serializable and deserializable from an "Envelope". It has an arrayelement named "Items" that can contain subclasses of the abstract "Item".
[XmlArray("Items")]
public Item [] Items { get; set; }
Now I need to add XmlArrayItem, but the number is not "fixed". We use so far reflection to find all subclasses with a KnownTypeProvider so it is easy to extend the assembly with new subtypes. I dont really want to hardcode all items here.
The class is defined accordingly:
[XmlRoot]
[KnownType("GetKnownTypes")]
public class Envelope {
but it does not help.
Changing Items to:
[XmlArray("Items")]
[XmlArrayItem(typeof(Item))]
public Item [] Items { get; set; }
results in:
{"The type
xxx.Adjustment
was not expected. Use the XmlInclude
or SoapInclude attribute to specify
types that are not known statically."}
when tyrying to serialize.
Anyone an idea how I can use XmlInclude to point to a known type provider?
The KnownTypesAttribute does not work for XmlSerializer. It's only used by a DataContractSerializer. I'm quite sure that you can exchange the serializer in WCF, because I have done that for the DataContractSerializer. But if that's not an option, you have to implement IXmlSerializable yourself and handle type lookup there.
Before disqualifying this solution: You just have to implement IXmlSerializable just for a special class which replaces Item[]. Everything else can be handled by the default serializer.
According to: http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/83181d16-a048-44e5-b675-a0e8ef82f5b7/
you can use different XmlSerializer constructor:
new XmlSerializer(typeof(Base), new Type[] { typeof(Derived1), ..});
Instead of enumerating all derived classes in the base definition like this:
[System.Xml.Serialization.XmlInclude(typeof(Derived1))]
[System.Xml.Serialization.XmlInclude(typeof(Derived2))]
[System.Xml.Serialization.XmlInclude(typeof(DerivedN))]
I think you should be able to use your KnownTypeProvider to fill the array in the XmlSerializer's constructor.

Resources