umbraco and custom system table

221 views Asked by At

I have the following scenario:

My website db has a system table called "Companies", which includes an id field, companyName field, and companyImageUrl field.

How do I set up an umbraco document type for adding entries to this table ?

Maybe I shouldn't use a custom table at all ?

Thanks.

1

There are 1 answers

0
Jeremy Wiggins On BEST ANSWER

As far as I know, Umbraco doesn't support what you want to do out of the box (mapping a document type to a table that isn't part of the umbraco core).

One approach that might work is to create an action handler that syncs a Company doc type to your table when creating a node of that type.

It's a bit of a hack though. I've found that I've very rarely needed to create custom tables. What exactly are you trying to do with it? My guess is that you don't really need it and would be better off working with a doc type instead. Umbraco provides a variety of ways to get and act upon doc types from within custom C# code (check out the umbraco.NodeFactory namespace). You'll also get the added benefit of being able to easily interact with these nodes from XSLT/Razor.