Proper Naming Convention and Structure for Class-Based Resource Kit

I’ve started writing a DSC Resource, just to automate something small (Get-/Set-NetConnectionProfile) and decided to go the class-based route as this seems cleaner / easier.

Couple of questions:

1. With non-class-based, traditional DSC Resources, there was a very defined structure that you put the files in for packing up in a module. (You only have to look at any of the MSFT_* in the Modules area to see what that structure is like.) You would have one module that contains multiple DSC Resources under the ‘DSCResources’ folder.) However, when it comes to class-based resources, the only examples I’ve ever seen on the web and in the MVA courses are just 1 DSC Resource, i.e. just one .psd1 file and one .psm1 file that contains the actual resource class.

If you wanted to have multiple class-based DSC Resources per module, would you stick all the classes in the root module .psm1 file? Or would you just nest them like you did before under DSCResources (or whatever folder) and dot-source reference them in the root .psm1 file by doing something like:

. $PSScriptRoot\DSCResources\Company_MyResource1\Company_MyResource1.ps1
. $PSScriptRoot\DSCResources\Company_MyResource2\Company_MyResource2.ps1

2. As far as naming conventions go, they were very laid out with the traditional DSC Resources, but with the class-based resources I haven’t seen any examples using the Company_* convention in folder names, file names or class names. Are guidelines around class-based naming conventions different than that of traditional DSC Resources?

Searched around online quite a bit for some best practices / guidelines around the above, but not finding much thought I would bring it to the forum. Thanks.

Correct - class based resources live In a root module, which is different from v4 resources. All the classes go in a single module.

Naming conventions are whatever works for you - and the Company_ is still good. That applies to the class names.

But keep in mind that you’re talking about stuff that hasn’t shipped and isn’t production. It’s a little early to start speculating on practices and patterns, yet :slight_smile:

Great, thanks Don! Even though it’s still early it’s nice to have something to aim for. :slight_smile:

I wish you can get some short tips from here, it is the same service I am using.