Base solution for your next web application

Activities of "klawsuc"

Answer

My apologies. I just looked at the id dataTable and assumed it was the tag. Thanks for the clarification.

Question

The datatable in Prime NG was deprecated. Is there are reason why the ASP.NET ZERO is still using it in v6? I want to make sure there isn't something extra happening in the datatables befor I switch them to turbotable. I will be using turbotable for all my custom pages and want to keep a consistent look.

Not sure if the subject line reflects what I want. I have a repository for a Company which has a relationship to CompanyAddresses which in turn has a relationship to Addresses. I have the following code to get the Company and related data. However I would like to get the actual Addresses referenced in the CompanyAddresses table in the same query if possible.

var company = await _companyRepository
                    .GetAllIncluding(
                        c => c.Patients,
                        c => c.CompanyAddresses,
                        c => c.CompanyEmails,
                        c => c.CompanyPhones
                    )
                    .FirstOrDefaultAsync(o => o.Id == input.Id);

Company class has the following:

public virtual ICollection<Patient> Patients { get; set; }
public virtual ICollection<CompanyAddress> CompanyAddresses { get; set; }
public virtual ICollection<CompanyEmail> CompanyEmails { get; set; }
public virtual ICollection<CompanyPhone> CompanyPhones { get; set; }

Thanks again. Makes sense. I'll poke around the documentation to see how to actually set that up.

@aaron I read the post but unfortunately I'm not sure what to do with that information. Any sample code or information would be greatly appreciated. I'm fairly new to mvc and structured code...coming from the old aspx pages world. Thanks.

Thank you! Addresses are a one-to-many relation (Companies can have many different addresses). But addresses are also used for patients and users which is why I have the CompanyAddress table. I will look at the link.

I have the following classes/tables:

Company : FullAuditedEntity<int>, IPassivable, IExtendableObject
Address : FullAuditedEntity<int>, IPassivable
CompanyAddress

The CompanyAddress class has the companyId, addressId, and an address type..it does not have an entity id like the other classes. I want to be able to add an address and if successful, add an entry into companyAddress. Then commit the changes so that these entries are only saved if they both succeed.

First of all what is the best way to add a record to the non-entity table (CompanyAddress). In the CompanyAppService i added

private readonly IDbContextProvider<DbContext> _contextProvider;

Then in the AddAddress method I have

CompanyAddress ca = new CompanyAddress();
ca.AddressId = addy.Id;
ca.CompanyId = input.CompanyId;
ca.AddressTypeId = input.AddressTypeId;
DbContext dbc = _contextProvider.GetDbContext();
dbc.Add(ca);

Next question, I have an AddressAppService with an insert method. So in the CompanyAppService.AddAddress should I be creating an instance of the AddressAppService and using the insert method to create the address? Or should I just create the record directly like I'm doing with CompanyAddress?

Basically what I am looking to have:

//Create an Address record and get the generated ID
//Insert a record into CompanyAddress
//on success of both, commit the changes to the db
//on failure, cancel saving the address

Should I be using UoW for this or just do an insert of the address and if it succeeds, attempt to add a record to CompanyAddress and if that fails, remove the address?

Thank you again @ismcagdas! Well that's helpful information. I thought the migration scripts were included in the published app...i.e. something like a check for db structure and updating it accordingly. Do you know if this information exists anywhere in the documentation so I have it for future reference?

Thanks for the reply @ismcagdas.

I ran the *.Migrator project. The database was created and I was able to run the site from VS 2017. When I published the Host project and ran the site on the server, that is when I get the error. Is there something else I have to do on the server? I thought the published application took care of the db setup and seeding.

I get the same error when trying to run a fresh copy of Core + Angular 4.4.0.

Showing 1 to 10 of 23 entries