umbraco and custom system table - asp.net

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.

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.

Related

2sxc - Get Entity created and last updated UserID

DNN 9.1.1.
2sxc 9.14.
Is it possible to get userId or name of the user who last changed the entity and displays it in razor template?
Is it possible to get userId or name of the user who created the entity and displays it in razor template?
Is it possible to get entity history and displays it in razor template?
Also what about created and updated time of the entity?
Can someone give me some links to samples or documentation about this stuff?
Yes, accessing the owner is the right way - you'll have to work a bit to map it to DNN, but it's simple string splitting. Note that in some future release we'll probably change the owner mechanism to map to the guid instead of the ID, but that will still take a while and will be easy to adapt to once it happens.

Symfony Mapping in Doctrine without Annotations or XML Files

a customer has an existing database. The schema is often changed within the database itself (e.g. he adds a new column).
My task is to develop an admin area with symfony that automatically reacts on table schema changes without modifying the application code. E.g. the customer adds a new column to table "MyEntity", and the application automatically generates a new column in the accordingly list view.
My approach is to dynamically map the table columns to the Entity class so that ALL Attributes and ALL Getters/Setters are generated dynamically from the table schema.
So is it possible to map the table columns in a Doctrine Entity without the use of Annotations or XML Files.
Something like:
class MyEntity{
public function generateMappingFromSchema($sTableName){...}
}
Please don't do that. Doctrine was not designed for such use case.
There is a library though you should check https://github.com/laravel-doctrine/fluent which basically is a mapping driver that allows you to manage your mappings in an Object Oriented approach. And there are other tools:
http://crud-admin-generator.com/
http://crudkit.com/
http://www.grocerycrud.com/
which are maybe better for that, I don't know.
But again, please don't do that. Do not allow the customer to modify the database schema or give them e.g. a phpMyAdmin which was designed for that.

Are Dexterity z3c relations between non-cataloged content possible?

Specifically, I want to be able to use Dexterity content that has a z3c relationfield pointing to a user in acl_users.source_users. The Plone documentation demonstrates how to create relations in the schema using plone.formwidget.contenttree, but the binders all seem to be based on catalog searches. Since users aren't content in this sense they aren't cataloged.
I'm not sure if this is even the best approach, but being able to link to a user seems simple as an abstract concept. I suppose the alternative would be to store the userid as a simple string field and listen for user management events.
There are two possible approaches:
(1) low-level indexing of relationships between content and users, possibly collective.subscribe (disclosure, I am the principal author, and the only example of this in use is collective.inviting, an event RSVP add-on). There are no widgets or UIs for this.
(2) If you simply want to pick users, you could just use a Choice field in your schema with a dynamic vocabulary of users in your system (example), and store the user-id on your content (unrelated warning: user name and user id can be distinct from each other; if you use email as login in Plone 4, I suggest you use collective.emaillogin4). The content tree widget is not going to work here, so look at either using a drop-down (for <200 users) or an auto-complete widget).

Using Node Reference without popup?

I am using two content types company and Employee . I am using node reference here(Company -> Employee). Within the Company form , the Employee node comes as a popup ,Employee form need to bring the display and functionality to the company form and should keep the node reference. .
Unfortunately, embedding one form in another is nearly impossible in Drupal. That is due to its form-handling and node-handling system.
If you want such relationships, you often need to write a simple, small module that maintains relationships in the database, offers forms to insert/update them and ways to extend nodes with your relational behaviour.
Best I could suggest is an iFrame holding the employee form - but still it's not very elegant.

ASP.Net Entity Framework Model

Is it possible to add properties to my model that dont exist in the database?
For example I have a calendar table, I want to retireve this data in my MVC controller then work out time left until each entry starts and return this to the view. So I would like another property in my calendar model to hold time left which is a value that I will generate outside of the database.
I've tried just adding the property but when I do that I get errors because the property is not mapped to anything.
Is this even possible?
Thanks
You should be able to add the property to the Model but you will not be able to query it with LINQ. LINQ will ultimately build and expression which it will want to run against the database using SQL. Its at that point that your LINQ will fail to find a mapping from your property to a field somewhere.
If your query returns an IEnumerable of the actual type on which you have created the property your view may be able to access it. I can't remember if EF insists on mapping in that case, it may do.
You might find that you can create subsequent LINQ query that uses LINQ-to-objects if you want to provide some other composite type to your view.
It's a non-persistent property or transient. I don't know Entity Framwork well but with a quick google search you should find the answer.
BTW you can find a lot of tips here :
http://weblogs.asp.net/zeeshanhirani/archive/2008/12/18/my-christmas-present-to-the-entity-framework-community.aspx
After making a quick search myself and a test in VS2008 I don't see a way to exclude a property from the mapping. Maybe it requires you to edit manually the mapping file ? :(

Resources