Hi everyone this is my first Umbraco project, so maybe this's a silly question.
In this project we want to add a new section/application in the umbraco backoffice called "provider" which contains the CRUD operations of our own business model.
After a few days of investigation I couldn't find out the way to create elements for the tree and create a new page to insert the form to make this operations.
Is it correct to create our own model instead of create our own dataType object? which cases it's recommendable to do it and which one not?(use datatype instead of create our own model)
So, is there any tutorial for the backoffice of umbraco7 to make this operations?
thanks in advice
The Umbraco Documentation available below should set you on the right path:
Umbraco Documentation - Section Trees
I also recommend taking a look at the Angular Workbook project here:
https://github.com/umbraco/AngularWorkbook
Related
Does asp.net mvc5 really not come with some sort of default controllers and views to manage your users? things like creating a new role, and then assigning it to a user etc etc?
Is every single mvc5 website supposed to code their own?
Over and over again?
I get that we can now add custom fields etc to our users, but surely some sort of simple base built in manager isn't asking for too much?
Is there some magical nuget package or something I'm missing?
There doesn't seem to be anything like this.
I have added an item onto the asp.net uservoice list and you can vote for it there.
I'm marking this as closed.
http://aspnet.uservoice.com/forums/41201-asp-net-mvc/suggestions/5009231-add-a-default-asp-mvc-5-microsoft-aspnet-identity
I've just finished creating a custom surface controller that sends out emails after a user has filled in details of a contact form.
However I'm trying to now store these records in a custom table but I'm not sure what available methods I have of doing this? In previous versions of Umbraco ie. < 4.8 I'd create Linq 2 Sql classes and then save my records using the DataContext object.
Now that Umbraco 6 has moved to MVC I'm a little unsure how I should proceed. I've been looking into using Entity Framework to add my custom records but now I've just seen this article and I wonder if there's another simpler way of adding these new records to my database?
Is anyone able to point me in the right direction here? What is the optimal way of adding records to custom tables in umbraco 6?
Thanks!
There are two answers to this question:
Use a framework/solution like EF;
Use Contour
If you haven't looked at it, Contour is an Umbraco plugin that does exactly what you need. See here for more information about Contour.
However, for more control I use PetaPoco or more recently NPoco (via NuGet) and also Autofac to inject the Database (analogous to DataContext) into the constructor of my Controllers.
This is super easy and if you aren't already using an IoC container like Autofac in your builds I would highly recommend looking into it. Especially if you stick with EF, as you could ensure that a single DataContext object was created and disposed for each request, making sure that you didn't have multiple contexts floating about.
I have a database name CostDB on a SQLserver. I need to create a page (ASP.Net MVC 4) with a simple dropdown list (i.e. Company Name) which will be directly bind to the Company column of DESE table from the CostDB database.
I am lost after looking at all tutorials and ASP.Net MVC4's own tutorials that what way to start? There are different ways of code first, model first etc. I already have the database. Do I need to create a Model first in this case? If so does it have to be exact name match from the DB table names? Or do I generate the model from the database?Which functions would I need to create if I need to show data in the dropdownlist on page load? Most importantly what is the order to create an MVC application for an existing DB. Among M,V,C, what to create first?
Completely new to ASP.Net MVC 4. Already did go through MVCMovies tutorial but with no luck. Any suggestion would be really appreciated.
I think the best answer is this: Whatever you are comfortable with and what works for you. There are tons of different approaches to development, and variations of each of those approaches. I tend to lean towards database first, as I don't have as much experience in code first.
Since you already have a database created, I think the easiest approach for your method would be to generate an EDMX off of your existing structure and go from there. Once you have the EDMX built and all the appropriate files referenced, it should be easy. Just populate a list from your EF model, toss it into the ViewBag, and then populate your control(s).
Here is a good link on how to do this. Populate #Html.DropDownList with a List using MVC
I would highly recommend PluralSight for learning any type of development, one of the best sites I have ever used. Best of luck!
The introductory videos for ASP.NET MVC 3 imply that the desired workflow is for me to declare classes that define my model (code-first design).
This strikes me as weird, since Visual Studio has a nice Entity Diagram designer which can generate such classes with navigation properties, etc.
Is it possible to use that Entity Diagram designer to design the model (model-first design), and have ASP.NET MVC 3 understand the generated classes as its model?
Please provide precise steps if possible :) Thanks :)
Apparently it is not possible.
(Anyone wishing to prove me wrong and show how it can be done, please be my guest, but please provide steps :) )
Yes, this is called Model First design. Most of the video's you see have used the Code First approach. There are benefits to both.
This video should help you out.
http://msdn.microsoft.com/en-us/data/ff628199
UPDATE:
Here are the steps I use:
Create new MVC Project, I use the default internet project.
Right click on Models folder, Create new Entity Model (choose empty model)
Drag an Entity onto the designer, name it User.
Right click on designer and choose Generate Database
Use context and entity in project.
It's not difficult, and it works just fine. And it works the same way Model First works anywhere else.
I have a very tough problem for me to solve, and I thought and searched alot and came down t one conclusion which I will mention down.
the problem is I have a client that wants to create a websites based on a Common functionality, so let us call it Modules, so what I thought is to use MVC Contrib Portable Areas, which are great ideas to plug Modules, but I have a big problem, let us say I created a Blog module which will be implemented in a new site he want, now some users have unique requirements like one of them needs to add Gallery of pictures to each article, or List of references in each article.
this would be easy in normal situation where you have one site to work on, so all what you have to do is
add a new gallery table with Foreign key to the Blog table.
regenerate Linq2SQl code and update the Model.
add new form elements to the Create, Edit, Delete Views .
add the logic in the controller.
but in my situation it is complicated and time cumbersome because of 2 reasons
if the new functionality is cool
and client decide to implement it in
all sites, then I have to repeat the
work for each site.
if the functionality is unique it will create inconsistency for me in future
that is why as first step to solve the problem I used Portable Areas to create Addons for each Module, now this will definitely ease my work by dragging 1 DLL for each new Module or Addon, but I have a little problem here, which
because the new Module or Addin is a
Dll, how can I create such a
functionality in My Admin panel to
install the new Addon or find any new
added Module/Addon dragged new DLLS
to the Main Application
What is best
practice to create an installation
procedure inside the Portable Area,
like Update the DB, New Routes, etc..
Now to the biggest Problem which is specific to Module Addon :)
let us take back the Article Gallery Addon, if I follow the logic I have mentioned above by creating it as a Portable area, it would be easier to create a functionality in the Module Code to loop through all Installed Addons and list them in the CRUD Views, but because I isolated the Addon and don't want to manually update the Main Module Code for the Reasons Above there will be no way for doing CRUD operations for the new Addons in Sync with the main module because there is no Foreign Key Relation, again because as I said above it may be Optional, so I thought of the following solution which I hope there would be a better one
First in Installation Process I will create a Table for the Gallery Addon, but instead of creating a foreign Key relation I will create a manual Foreign Key which will get populated by Generating a Unique ID in the Main Module Controller when I create record by using the following code then store it in ViewData and just pass it to the Addon Controller when I create the new Record,
private string GenerateId()
{
long i = 1;
foreach (byte b in Guid.NewGuid().ToByteArray())
{
i *= ((int)b + 1);
}
return string.Format("{0:x}", i - DateTime.Now.Ticks);
}
ViewData["FK"] = GenerateId();
but here are my Concerns
Is this way feasible or just plain
Stupid.
is this technique will
generate a truly unique key.
I am extremely sorry if my question is lame, but this is the best place to ask and I think many people would want to have such a functionality and hope someone will answer me
I think it's a great question. awhile ago I started working on a CMS project using MVC1, where I wanted to support plugins. I had it working so that the admin could drop a new plugin assembly into the bin folder, and next app start, it would scan all assemblies for IPlugin (or whatever) and load them. I embedded the partial views into the plugin assembly so it was all self contained. each plugin was given a unique identifier when it was placed on a page, and the plugin's controller knew how to use that ID to query it's own table (repository) for it's data. the main application didn't know anything about the plugin's schema.
the only difference here is that it sounds like you would have multiple websites running on the same database, and you need to differentiate which instances of the plugin you need for each website. I assume somewhere you've got a key that indicates which website it is, that could be used via foreign key to select only the plugins for that website for the page the user is on.
I'm not sure if this is an answer, I'm sort of just thinking out loud. hopefully it'll help the discussion a little.
EDIT: To automatically load plugins, I used NInject's ability to scan assemblies for IModules. My IPlugin inherits from Ninject.Modules.INinjectModule, and all plugins implement the IPlugin interface. Then on app startup, I have the following line:
kernel.Load( "*.Plugin.dll" );
where kernel is a Ninject.IKernel and that line will scan any assembly matching that file pattern, so I could drop in an assembly like Weather.Plugin.dll.