0

I'm experimenting with the new Umbraco 5 hive, and I'm kinda a bit confused.

I'm plugging in an existing Linq to SQL services layer, which I developed for a webforms site.

I don't know much about the repository pattern, my services handle all connections with the data context, and work very well.

I have made a few repositories that plug in to the hive, and handle conversion of my entities to the Umbraco TypedEntity type.

These repositiories reference my existing services layer, to retrieve, add, update and delete. The services also handle other entity specific functions, which will not be used by the hive.

Now, it's nice to plug in these services, and just reference them in the hive repositories, but it seems I may be doing things the wrong way round, according to the offical repository pattern as I have read about.

I know there's no hard fast rules, but I would appreciate comments on what I'm doing to achieve this functionality.

I've asked this here instead of the Umbraco forum, as I want a wider perspective.

Cheers.

  • Mind if I ask, but when you call Get() is that the primary key of a table ? So far I have a simple Hive provider to dynamodb working in the way you describe, but I'm not getting the bit about TypedEntity and relation proxies. The advanced hive provider template for vs is not real intuitive – MikeW May 22 '12 at 10:58

1 Answers1

0

I personally feel that the Hive is overkill. With the ability to use your own classes directly within razor macros, I think the best approach is to forego the hive altogether and simply use your classes. Why would you trade all of the power of your existing service just to make it fit into the hive interface?

If you're writing a library for other Umbraco developers, you may need to do this, but it's my personal opinion that the hive is over-engineered at worst and a layer of abstraction aimed at newish developers at best.

So, if I were to advise you, I would say to consider the more general principles: "Keep It Simple" and "You Aren't Gonna Need It". If the interface they give you offers a tangible benefit, implement it. If not, consider what you really gain for all of that work.

Sprague
  • 1,610
  • 10
  • 22
  • although not completely on point, this post on Ayende Rahien captures the spirit of the problem here. First, you're trying to trivialise complicated things (which inherently means you miss some of the details) and you're adding extra layers of abstraction that simply do not need to exist. http://ayende.com/blog/3955/repository-is-the-new-singleton – Sprague May 14 '12 at 12:12