Can required WCF4 DataMemeber's be organized into required groups? - c#-4.0

Is there a way to have required DataMember's within a DataContract to be organized into groups so that you really only require group one or group two but no both to be provided?
I am looking to see if there is functionality similar to Workflow Activity validation where you can flag InArgument's with a RequiredArgument and then use OverloadGroup attribute to put these into groups so that only the arguments in one of the specified groups are required.

It is not possible out of the box with DataContractSerializer but you can switch to XmlSerializer and use xsd:choice (XmlChoiceIdentifierAttribute) but be aware that this will affect your data class beacuse this construct has its own requirements.

Nope, there is no way to do this. Only way to group is to have two different classes and extract away members/properties into those classes, but still...you won't be able to dictate an "either-on" setting.

Related

Extending AccessInfo to Include Roles

I'm looking to extend the base Singleton "AccessInfo" to include additional information pertaining to the current user (such as roles.)
Is there a most favorable path to do this? I can see how to extend a Graph, Cache, but not seeing any documentation how to extend this area.
Unfortunately due to the way it has been implemented, there is not a way to add fields to that DAC and have them populated on instantiation, and since it's not selected from the DB like a normal DAC, I do not think events would fire for it.
If you would like to access Roles related to the current Users, this should suffice.
PXSelect<UsersInRoles,
Where<UsersInRoles.userName, Equal<Current<AccessInfo.userName>>>>.Select(this /*Or Base if it's a Graph Extension*/);
As there will likely be multiple Roles per user, you will need to loop.
foreach (UsersInRoles role in PXSelect<UsersInRoles, Where<UsersInRoles.userName, Equal<Current<AccessInfo.userName>>>>.Select(this /*Or Base if it's a Graph Extension*/))
{
//Some thing here
}

Drop down menu for String values in Hybris Management Console

I have a requirement to display a drop down menu for a String type in Hybris Management Console, restricting the value to some specific values.
As suggested in several forums, I tried to create this entry as an enumeration type but characters like '-' are to be allowed in the enumeration values, as this column receives some specific values which comprise of '-'.
How do I solve this issue?
The people advising you probably didn't understand your requirements. As such, an enumeration type is clearly not appropriate in this case. Consider the alternatives. Is there a Map Type available? What other type might allow you to achieve your goal?
Actually, you could use the hybris Enumeration. In hybris Enum Types have a code and a name. The code is the unique representation for this enum and cannot contain a "-". The name however is a localized representation of that value and can include every character your database is able to store. Have a look here:
https://help.hybris.com/6.5.0/hcd/8c895989866910148d6a802f06651702.html
Additionally, hybris enables you to dynamically create new enumeration values, which is kind of nice.

Reusing a custom ContentPart in the same ContentType

I'm trying to figure out the best way to handle a requirement I have for an Orchard module I'm building.
I have a ContentPart that has a few fields. One field is a ContentPicker that allows for multiple items to be associated to the part. The rest are descriptive information.
The issue I have is that I actually need to be able to include more than one of this ContentPart into a ContentType. I need to create a ContentType that has exactly 3 of this part.
Should I be making this into a field instead of a part? Is it even possible to have a ContentField that has other fields in it?
Or, should I somehow use all the same models and data structures, but somehow define it as 3 distinct parts?
Just wondering what the best practice to do something like this would be.
You can only have one part of each kind on a given type. You can't have fields that have other fields in it (instead - take an existing field and extend it with custom stuff).
As I understand, the actual problem is "how to make groups of fields with some metadata for each group", right? If so, there are a few approaches to solve the problem:
Create a custom field based on Content Picker (basically - take existing Content Picker and extend it with your metadata) and use this without the need for a separate part
Create one part to hold only the metadata for each field attached to it and attach 1 or more fields to it
Create 3 distinct parts. Parts should be thought of as extensions that add some unique features to an item. If you think it's logically ok to have 3 parts then go for it.

Microsoft SharePoint 2010 One to many

Is it possible to create some kind of one to many relationship between two lists into Microsoft SharePoint 2010? If it's possible i'd like to know how.
Let me know,
Thanks.
It depends on exactly what you want. You can create a lookup to another list using the custom fields within a list or content type.
But if you want to go to the maximum with one to many relationships then you would have to create a custom field using some custom field using c# code.

NSArrayController that is sorted and unique (no duplicates) for use in a pop-up in a core-data app

I have core data app with an entity OBSERVATION that has as one of its attributes DEALNAME.
I want to reference through Interface Builder or by making custom modifications to an NSArrayController a list of unique sorted dealnames so that I can use them in a pop-up.
I have attempted to use #distinctUnionOfSets (and #distinctUnionOfArrays) but am unable to locate the proper key sequence.
I can sort the ArrayController by providing a sort descriptor, but do not know how to eliminate duplicates.
Are the #distinct... keys the right methodology? It would seem to provide the easiest way to optimize the use of IB.
Is there a predicate form for removing duplicates?
Or do I need to use my custom controller to extract an NSSet of the specific dealnames, put them back in an array and sort it and reference the custom array from IB?
Any help would be appreciated. I am astounded that other have not tried to create a sorted-unique pop-up in tableviews.
You need to take a look at -[NSFetchRequest returnsDistinctResults]. That is the level you need to be handling the uniquing of data.
Although I do not have a definitive answer for you, I think there are two ways you can go about it.
The way you already started. You need to bind the contents array of the PopUp button, not just against the arrayController.arrangedObjects, but continue on the path and somehow filter only objects with distinct "DealName"s. This means - the arrayController presents ALL the entities (and may sort them for you) but the PopUp button will have its contents filter via some sophisticated binding to the array controller.
Make your filtering at the ArrayController level (as suggested in another answer here). Here it depends how you set up the array controller. If It is set up to use an "Entity" (vs. "Class") which means the array controller will fetch CoreData entities directly - you can modify its "Fetch" to only bring a subset of the "OBSERVATION" entities with distinct values of "DEALNAME". I don't know how to control WHICH entities are filtered out in this case. Otherwise, you can setup the arrayController to work with "Class" objects, and then you can fetch the entities yourself (in code) and populate the arrayController programmatically, with just the entities you like.
In the second option, the Popup button should be bound normally to the arrayController's arrangedObjects.

Resources