3 thoughts on “Creating early-bounds manually

  1. Finding this 5 years later with a similar take. I’ve begun work cleaning up my generated early bound classes. So much repetitive code! Why couldn’t they compile a base entity with all the necessities and derive everything from it? That’s my goal anyway, and this article makes it clear your goal was once much the same.

    I’d like to take this a step further though, and intercept those getters and setters with completely generic methods. Set that LogicalName property by the base class as well. My limited research tells me I should be able to accomplish this with something like PostSharp. Then all of the entity properties could simply be written with auto “get; set;”s. The AttributeLogicalName decoration would be all that’s needed.

    Was wondering if you took this any further yourself in the 5 years since you first wrote this?

    Like

    • Hi Brad,
      PostSharp is agreat tool and if you can use it on your project, then for sure it should allow you to achieve this goal. Unfortunately I had to gave up on this approach, simply because I was outvoted by other people on the projects that I was involved in. People simply like to generate this stuff automatically and do not want to build this themselves although those classes aremso much cleaner especially for OOTB entities where you only have your 20 attributes which you actually use, not 500 shipped by MS which you don’t need. But like I said, people say that this is additional complexity. I did not have time to work on some good tooling for testing those classes, because what is quite important is that if you make a spelling mistake in attribute name, you can get a lot of strange errors that are hard to find for newbies, ,so it would be good to have a way of verifying those LogicalName attributes somehow.

      Like

Leave a Reply to Brad Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s