How to write mapping conditions in Devart's Entity Developer - entity-framework

Does anybody know how to use the "Conditions" feature in the "Mapping Details" option of the Model.
I have tried adding Conditions like "IsDeleted = False" or "IsDeleted = 0" and nothing works. Just get errors.
Many thanks.

It seems that one cannot use a mapped property. Once I removed this, the condition worked. However this means that one cannot update this property via EF, and instead one has to use raw DDL via ExecuteStoreCommand.
Hope this helps someone. It got me scratching my head !!

Related

Pymongo3.6 check_keys not doing it's job

I need dots in my keys in mongo. So, while inserting I am sending 'check_keys = False'. This was working fine for pymongo3.4. But I recently updated to pymongo3.6 and I am getting the InvalidDocument Error even when I am sending check_keys=False. Is there any way around this problem?
db['test'].insert([{'a.b': 'asd'}], check_keys=False}
Please try this out using both Pymongo3.6 and Pymongo3.4
Use insert_one method instead as insert is deprecated, and supply bypass_document_validation=True parameter.
I'm having a similar issue, and I found that update_one seems to not care about the dot (.), so I'm considering to create an empty object first, with insert_one, then add the contents to it later using update_one, that way bypassing that limitation. Not the cleanest solution, but could do the trick.

Sparx Enterprise Architect DocumentGenerator does not honour TaggedValues on Stereotype or values from SetProjectConstants and ReplaceField

maybe someone can help me on this. I am trying to generate a document via the DocumentGenerator interface. All in all this works well, except that the DocumentGenerator does not replace the Report Constants with actual values (which are defined on the report package stereotype.
This is the general flow of the document creation code (which generally works):
var gen = Repository.CreateDocumentGenerator();
gen.SetProjectConstant("ReportName", "My Project");
gen.NewDocument(string.Empty);
gen.ReplaceField("ReportName", "My Project");
gen.InsertCoverPageDocument(tags[REPORT_COVERPAGE]);
gen.InsertBreak(DocumentBreak.breakPage);
gen.InsertTOCDocument(tags[REPORT_TOC]);
gen.InsertBreak(DocumentBreak.breakPage);
gen.DocumentPackage((int)nativeId, 0, template);
gen.SaveDocument(fileName, DocumentType.dtDOCX);
I tried ReplaceField and SetProjectConstant both and one at a time before and after calls to NewDocument/InsertCoverPageDocument:
Strangely there is one constant that is being replaced: ReportSummary.
When I run the document generator via "F8" all constants are being replaced correctly.
Other project constants are being replaced correctly.
I can reproduce the behaviour on EA v14.1.1429 and v12.0.1215.
Does someone have a hint for further troubleshooting? Thanks in advance!
========== UPDATE ==========
When I use ReplaceField at the end (before the actual call to SaveDocument the following Report Constants get replaced: {ReportTitle} and {ReportName}
I discovered some workaround: when I manually remove the predefined {Report~} constants from the template and re-add them as Project Constants, their values get replaced correctly.
I will examine this further and give an update as
I did some further investigation on this and came to the following conclusion and workaround (as I have received no comments or answers on this):
I deleted all references to ReportConstants in my EA templates and replaced them by ProjectConstants with the same name.
In my code where I want to generate the documentation I (re)set all ProjectConstants with the actual values via SetProjectConstant and additionally added a call to ReplaceField to replace the constants with the actual values.
The previous mentioned calls are inserted directly before the call to SaveDocument document.
tags.ForEach(t =>
{
if (string.IsNullOrWhiteSpace(t.Key)) return;
generator.SetProjectConstant(t.Key, t.Value);
generator.ReplaceField(t.Key, t.Value);
});
generator.SaveDocument(fileName, DocumentType.dtDOCX);
If someone comes up with a better resonse or explanation for the behaviour I am happy to accept this as answer.
I have also found that when you call ReplaceField on these project constants in a CoverPage template, the formatting defined in the template is overwritten. It seems that some of the SetProjectConstant calls actually set the values as you would expect, and the rest do not.. hence the need to call both sets of APIs.

Re-add value into EXTRA_OECONF_<name> after it was removed by EXTRA_OECONF_remove_<name>

To configure a component I need to add --enable-feature into EXTRA_OECONF_somename
So I tried to do:
EXTRA_OECONF_append_somename = --enable-feature
But it did not help. After investigation it was found that the one of the third-party recipe contains the following line:
EXTRA_OECONF_remove_somename = --enable-feature
I can't modify the third-party recipe.
Is there a way to add --enable-feature into EXTRA_OECONF_somename
Thank you.
I'm afraid not. The _remove operations are always applied last so there is no way to undo them. I would say that the original recipe shouldn't be using it - _remove is intended for distro policy where you want to say "I don't care how this item got in the value, just remove it".
For preference the original recipe should instead it should be using PACKAGECONFIG to control addition (or not) of this feature.

Using sails and waterline, where is the showJoins option set when using toObject()?

Using the Model.toObject() call , I saw that all association keys were being stripped. Looking through the documentation, it seems there's a showJoin option as well as a joins[] array of keys to include.
But, I haven't found a place where to send in or set those options. Anyone know?

How do I empty out a collection if I'm using TryUpdateModel?

I have a model that contains a List<PhoneNumber> property. I use TryUpdateModel in my update actions. Adding new numbers and changing existing numbers works fine. Removing existing numbers, however, works only if I don't try to remove everything. If I remove everything from the list, none of the items get deleted.
I realize that this is probably by design, but what's the recommended approach for dealing with this problem?
I'm currently going with this approach:
List<PhoneNumber> phoneNumbers = new List<PhoneNumber>();
TryUpdateModel<List<PhoneNumber>>(phoneNumbers, "Student.PhoneNumbers", form);
if (phoneNumbers.Count == 0)
{
student.PhoneNumbers = phoneNumbers;
}
I know the question is 2 years old and for MVC2. However, I did find the same issue in MVC3 and found the culprit and the solution. I answered the following question since it was the same problem that I was having, and hopefully, the solution is also applicable here without changes.
Related answer: TryUpdateModel does not empty a collection of items when all items are removed on screen.