uSync-Legacy icon indicating copy to clipboard operation
uSync-Legacy copied to clipboard

Allow conditional removal of missing properties

Open lucasch opened this issue 9 years ago • 1 comments

As I mentioned in my comment to #59, I have a use case where I need to leave properties that in are Umbraco (but not uSync configs) in tact. I'd like to have a way to specify, on the handler, whether the deserialize operation should remove properties or not. This really only makes sense on the ContentType and MediaType serializers.

I've been trying to come up with clean methods to do this and I think the cleanest way to do this would be to pass the uSyncBackOfficeConfig to the Core Init() method (Or at least a bool pulled from the BackOfficeConfig). Everything else looks like it'll just tangle up all the other serializers with extra fields that don't necessarily make sense. I'm not sure that having Core depend on the BackOfficeConfig is appropriate coupling, either.

Any thoughts?

lucasch avatar May 17 '16 14:05 lucasch

Yeah

I think it needs passing on to the serializers as the import is processed, because that's a bit more thread safe than passing it to the init() functions.

I think it's probably going to be a case of extending the ISyncSerializer class to pass this in. Thinking about it it might make sense to move from passing in individual config params, (like the force param,) and move to a setting class - this makes it way easier to extend if we think of more things to pass, because you just need to change the settings class not the interfaces or handlers that don't matter.

KevinJump avatar May 17 '16 17:05 KevinJump