Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "BobIngham"

@aaron - thanks, another piece of magic pulled from the magician's hat!!!! But before you light up that cigar can you tell me why the following code in my InitialOrganizationUnitCreator class fails when trying to add a child organization unit?

public void Create()
{
    var root = _context.OrganizationUnits.IgnoreQueryFilters().FirstOrDefault(m => m.TenantId == _tenantId && m.DisplayName == "Acme Care Home");
    if (root == null)
    {
        using (var organizationUnitManager = IocManager.Instance.ResolveAsDisposable<OrganizationUnitManager>())
        {
            organizationUnitManager.Object.Create(new OrganizationUnit(_tenantId, "Acme Care Home", null));
        }
    }
    _context.SaveChanges();
    root = _context.OrganizationUnits.IgnoreQueryFilters().FirstOrDefault(m => m.TenantId == _tenantId && m.DisplayName == "Acme Care Home");

    var admissions = _context.OrganizationUnits.IgnoreQueryFilters().FirstOrDefault(m => m.TenantId == _tenantId && m.DisplayName == "Admissions");
    if (admissions == null)
    {
        using (var organizationUnitManager = IocManager.Instance.ResolveAsDisposable<OrganizationUnitManager>())
        {
            organizationUnitManager.Object.Create(new OrganizationUnit(_tenantId, "Admissions", root.Id));
        }
    }
}
Answer

Jeepers, @ jollyticket - aspnetzero is PERFECT for no-sql databases. Serialisation of EntityHistory gives you the initial document and every change thereafter gives an additional document. You could even throw the the serialised result on to a command bus to give you CQRS. If the result of your project has to be a Mongodb database (and I can understand why that may be) and the start point has to be aspnetzero then this is the way to go. Leave the relational database where it is, it is serving the purpose it is designed for. Don't re-invent the wheel.

... and don't over-engineer.

Good luck on that deadline, I hope it all works out for you!

Answer

@jollyticket - If you want all of your data in Mongodb why not cut into EntityHistory functionality and serialize the results using the .net Mongodb driver? That way all of your data will be in Mongodb and your relational stuff will be where it should be, in a relational database? Just a suggestion but it may give you a different direction of thinking because I think you will be pulling your hair out trying to get a system out with an unsupported solution????

@faisalalam - have you tried un-checking the "Add migration" checkbox? Then make the adjustments, including foreign keys, to your entities. Add a migration manually and then update-database. Refresh the swagger interface and you should be good to go. Sorry if this is not appropriate but this is what I do with the aspnet-core/angular project. Hope this helps, if not I'll try to butt-out in the future!

@ismcagdas - thanks for this, I knew I had seen it previously in the forum but was unable to find it. In my solution I create a master component which controls navigation between list, read and create-or-update components.

master
--list
--details
--createorupdate

I implement the code you showed me into the master component and the job is done. Thanks for all your help, this can be closed!

Answer

@ dparizek bump. bump. bump. Build the database, reverse to models, create the UI. I am with you.

@ismcagdas - thanks for your time on this. I will come back to the problem later but I'm beginning to think that the ability to get and set values on the server give me little advantage. I will take a look at mapping to a typescript interface in Angular later but all-in-all I think a simple nvarchar(max) with raw json will give me better results. Again, thanks for your efforts.

Answer

@ismcagdas - thanks.

@ismcagdas - perhaps an easier question would be to ask: Once I have ExtensionData set as follows,

{"DataProviderId":"653","DateOfBirth":"03/02/1971 00:00:00"}

how the hell do I iterate over it in Angular?

I have tried pipes and Object.keys but I am getting nothing meaningful.

Is there any code examples of using IExtendableObject in Angular or should I revert to using plain JSON saved in an nvarchar(max) column?

@ismcagdas - the tests gave me a lot of pointers, thanks.
I read a third party database, get the relevant row and iterate through the columns in the database using sys.columns and, if the cell has a value I save it into a dictionary. I serialise the dictionary and pass it back to Zero where it is deserialised and then, using a foreach loop, I use entity.SetData() for each key-value-pair. I now have a set of entities in Zero and I want to get the data from ExtensionData. Each entity has a different number of kvp's and each may have different values for keys. My question is:

Is there any foreach mechanism to read through each KVP in the IExtensibleObject interface or am I faced with casting json back to a dymanic object and iterating through that (which kind of negates the whole point of IExtensibleObject?

Showing 421 to 430 of 477 entries