Can I delete/edit Models after they've been created through the GUI? - laravel-backpack

Typically I build up the models, then loop back and put the relationships in. It seems that I cannot do that in the GUI. I also cannot create a model without a migration, and then create the migration once I've 'fine-tuned' the model. Any advice? I also noticed that CRUDs is greyed out in the menu at the top. Is it possible I loaded something incorrectly?
-Regards

Related

QgsRelationEditorWidget configuration example with python code

I'm learning to use python to control forms in a Qgis project where I use some QgsRelationEditorWidgets to edit attributes of entities in various related layers.
I need information (if possible, some code example) on how to control the Widget with phyton: select the editing buttons to show, activate/deactivate these buttons depending on whether the entity is being edited, etc.
Any idea or reference where to look?
Thanks in advance.

Using pre-generated views with DevForce EDMX

I am using Entity Framework Tools 6 to pre-generate views for my EDMX model. Everything looks great and compiles, however I don't see actual difference. Breakpoints anywhere in views file doesn't get hit.
I also tried to change model and it should not work without re-generating views but it does. That makes me think those views is not getting used and I'm not sure why.
I cross-checked with article mentioned here: EF6 don't use pre-generated views but all looks good.
EDIT: Tried the same with another non-DevForce EDMX and it works as expected. So, it's a question on how to enable those pre-generated views for DevForce context

edmx context loses views mapping

all.
I am using entity framework and I am trying to add three new tables to my context. The problem is, I go to "Update Model From Database", select the tables and after the new tables are added in the context, my entities which refer to views, they lose mapping!
Then, I click on the entity, then on "Mapping Details" and when I click on "Maps to" I cannot see the views anymore, only the tables.
Where did the views go? Why did they lose the mappings? What do I do to solve this issue?
Best regards.
I still do not know why the views vanished when I updated my data model, but now I got my solution working.
What I have realized is that even if I created a new context and added only the views, they were not added! (Still I don't know why).
What I did to solve this issue was: I copied the XML file, where I had all my views, tables, etc. Then, I updated my context, adding the tables I needed. After that I edited the new XML file, adding the views' code.
This solved my issue. It's not ideal, but it solve.

Views does not import to Entity Framework

I have a few views in my database that im using in my ASP MVC-application. Now I am experiencing a very strange problem. There are 8 views in the database but even if I check them all in the Create Enity Data Model-guide only 7 of them are available as objects in the datacontext.
If I try to import ONLY the view that gets left out I get an empty model.
Is there some kind of limitation that I dont know of? Or is this a known problem?
Sounds like there is something special with this view. Things to check:
Are the rights the same on this view as others?
Try running a select on this view from query manager to confirm that it works
Open up the "empty" model in an xml view and see if there are any error messages in it
I have ran into issues importing tables and views with no key defined. The entity framework will try to assign one automatically if it can, but if you have duplicate data you may have to create a primary key before EF will bring it in.
That didnt do the trick. I removed all joins from the view definition and added a very simple view (basically just a select from a single table). That worked. Then I added the joins one by one and made the view more complicated for each step. Now I have the same view as I had before I started this process and I can now import it without problems. Something is strange in the state of Denmark

Where to store "global" data in Eclipse RCP Application?

I'm a beginner with Eclipse RCP and I'm trying to build an application for myself to give it a go. I'm confused about how one actually goes about handling model objects. None of the examples I can find deal with the problem I'm having, so I suspect I'm going about it the wrong way.
Say I need to initialise the application with a class that holds authenticated user info. I used my WorkbenchWindowAdvisor (wrong place?) to perform some initialisation (e.g. authentication) to decide what view to show. Once that's done, a view is shown. Now, that view also needs access to the user info I had earlier retrieved/produced.
The question is, how is that view supposed to get that data? The view is wired up in the plugin.xml. I don't see any way I can give the data to the view. So I assume the view has to retrieve it somehow. But what's the proper place for it to retrieve it from? I thought of putting static variables in the IApplication implementation, but that felt wrong. Any advice or pointers much appreciated. Thanks.
The problem you are facing here is in my opinion not RCP related. Its more an architectural problem. Your view is wired with business logicand!
The solution can be done by two (common) design-patterns:
Model-View-Controler (MVC)
Model-View-Presenter (MVP)
You can find plenty information about this in the web. I am going to point a possible solution for your particular problem using MVP.
You will need to create several projects. One is of course an RCP plugin, lets call it rcp.view. Now you create another one, which doesnt make UI contributions (only org.eclipse.core.runtime to start with) and call it rcp.presenter. To simplify things, this plugin will also be the model for now.
Next steps:
Add the rcp.presenter to the
dependencies of rcp.view (its
important that the presenter has no
reference to the view)
Export all packages that you are
going to create in the rcp.presenter
so they are visible
In rcp.presenter create an interface
IPerspective that has some methods
like (showLogiDialog(), showAdministratorViews(User user), showStandardViews(User user))
Create a class PerspectivePresenter that takes IPerspective in the constructor and saves it in an attribute
In rcp.view go to your Perspective, implement your interface IPerspective, and in the constructor create a new reference presenter = new PerspectivePresenter(this)
call presenter.load() and implenent
this in the presenter maybe like this
code:
public void load()
{
User user = view.showLoginDialog(); // returns a user with the provided name/pw
user.login(); // login to system/database
if(user.isAdministrator())
view.showAdministratorViews(user);
else
view.showStandardViews(user);
}
As you can see, the view just creates a reference to the presenter, which is responsible for all the business logic, and the presenter tells the view what to display. So in your Perspective you implement those interface functions and in each one you can set up your Perspective in a different way.
For each View it goes in the same way, you will need a presenter for the view which performs operations and tells the view (using the interface) what to display and passing down the final data. The view doesnt care about the logic. This is also very usefull when using JFace-Databindings (then only bound data is passed to the view).
For example, the WorkbenchWindowAdisor will just create everything that is needed in the application. Other views, perspectives, then can enable/disable menus and so on depending on the data they got (like when isAdministrator you might want to enable an special adminMenu).
I know this is quite a heavy approach, but the Eclipse RCP is designed for big (as the name says rich) applications. So you should spend some time in the right architecture. My first RCP app was like you described...I never knew where to store things and how to handle all the references. At my work I learned about MVP (and I am still learning). It takes a while to understand the concept but its worth it.
You might want to look at my second post at this question to get another idea on how you could structure your plugins.