Hi!
Why do you want to save the data for your CMS property in a Commerce object instead of the actual CMS object? What is it that you are trying to achieve?
Yes I want to save it as a Commerce object instead of a CMS object. After doing more research on the issue, I see that there is a CountryDto and a CountryManager. Is there a way to extend these classes and to accomodate country name translations?
Hi!
Though you can do pretty much anything in a custom property I have never heard about someone doing something like this. The reason for this is that a custom property is just a piece of code that handles a bit of data. It does not know much about the parent object or it's life cycle. The normal aproach when dealing with other systems is to make a property that holds a reference to an object stored elsewhere, but not to actually create and manage this object.
If you need to do this I would probably add an event handler to the parent object (for instance a page) and make sure that I update the external system (for instance Commerce) whenever the object is being published.
I agree, hooking up on for example SavingPage or SavedPage event seems a bit more kosher
Quick update:
I've tried what you suggested and it works so far. The question I have now is where is the SavingPage or SavedPage method? I only see SaveData method and I don't think I'm suppose to be using this to save/merge changes to the DB.
Check out the PublishingContent event on DataFactory.Instance. You can also fetch out the registered instance for the interface "IContentEvents" if you want to work with the IOC container for testability.
So I would have to modify the save method in the PageType that uses the custom property? There isn't a way to do this in the custom property itself?
I'm sorry for importuning you guys with questions. I'm still new to EPiServer and still learning the EPiServer system.
I'm looking to create a custom CMS property and that saves values to the Commerce DB instead of the CMS DB. The values would have to be parsed to save the data accordingly. For example:
USA=Estados Unidos,
BGR=Bielorrusia
Is this possible to create a custom property to parse this and save it to a newly created business foundation object?