Open HeToC opened 7 years ago
Until we get a great solution and nice looking API around this one, there are a few kind of dirty workarounds:
/// use this static list, clean up ModelWeigh for typeof(ListDefinition)
/// this thing controls how definitions relate to each other and what's the order while provisioning
DefaultModelWeigh.Weighs
// default model weight looks as following:
// https://github.com/SubPointSolutions/spmeta2/blob/master/SPMeta2/SPMeta2/Common/DefaultModelWeigh.cs
Another way around is to implement your own DefaultModelWeighService
similar to this:
// https://github.com/SubPointSolutions/spmeta2/blob/master/SPMeta2/SPMeta2/Services/Impl/DefaultModelWeighService.cs
public class MyDefaultModelWeighService : DefaultModelWeighService
{
/// override this method and retuen your own weighs for ListDefinition
public override IEnumerable<Common.ModelWeigh> GetModelWeighs()
{
return DefaultModelWeigh.Weighs;
}
}
// then register your custom service instead of out of the box one:
provisionService.ReplaceService(typeof(ModelWeighServiceBase), new MyDefaultModelWeighService ());
These would be really dirty workarounds to get things moving. Also, this ticket relates to Option to use the order of nodes in which it is defined on model #1014
Meta seems to be sorting fields added to the list by type.
Is there a way to remove that sorting cause its is expected to fields to be added in the order they are defined in the code ?
I'm using StandardCSOMProvisionService SPMeta2FileVersion : 1.2.17191.0958 CSOMProductVersion: 16.1.5715.1200 SharePoint 2016 OnPrem