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

Activities of "Garysund"

  • What is your product version? 11.1
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? .net core

Hi There

I am trying to run the RAD power tools to create my entities and UI. I populate all fields and create a property.

When I click generate nothing happens. The cmd window just closes. I see that the json file was created in the AspNetZeroRadTool folder for my entity but nothing else was created.

I have installed all pre-requirements on the overview page. I am using vs 2022 community.

Where can I find logs of the issue or how can I resolve this.

Thanks

Question

Hi there, I recently purchased the upgrade for aspzero via the 50% Black friday special. I cant find the invoice anywhere. I cant see it under my profile. Please would you send it to me. Thanks, Gary

Question

Hi There

I would like to add a counter on the menu showing how many items there are for a particular menu item.

How would I extend the menu provider to handle this. I am using the MVC Jquery version of asp.net zero

Thanks

Hi There

I am trying to delete all records that are linked to a particular UserId. I have added a foreign key to the user table.

I am using the following Function

await _userCategoryRepository.DeleteAsync(p => p.UserId == AbpSession.UserId.GetValueOrDefault());

Could it have something to do with Cascade delete.

I dont want to lookup all the items then delete them as it will add processing time.

Thanks

Question

Hi There

I am building a mobile app that talks to my ASPNETZERO API.

I was just wondering about security and how to implement something.

Once the user logs in he gets his auth token. I need the user to also fetch his user profile ie GetUserProfileByEmail.

I would like to know how could I prevent a person from fetching another users profile if they know their email address.

Or should I return the users id when they log in and make all other calls using the userid.

The account(login) webapi returns an ajax response is it possible for it to return an object.

Any suggestions will be greatly appreciated.

Hi There

I have a view with many file upload controls on it with alot of other form fields aswell.

I am trying to post to a controller using ajax but I not sure how to post all the form fields without explicitly sending them. Any ideas?

controller

[HttpPost]
        [UnitOfWork]
        [DisableValidation]
        public virtual async Task<JsonResult> UpdateProfile4(UpdateProfile4Model model)
        {

            var filestest = Request.Files["CompanyRegDoc"].FileName;
          
            var supplierDetail = await _supplierDetailRepository.GetAsync(model.SupplierDetailId.GetValueOrDefault());

            supplierDetail.CompanyRegDocId = await UpdateFile(Request.Files["CompanyRegDoc"], supplierDetail.CompanyRegDocId);

            await _supplierDetailRepository.UpdateAsync(supplierDetail);

            return Json(new AjaxResponse { TargetUrl = "Terms" });

        }

Ajax call

var $loginForm = $('.profile4-form');

        var formdata = new FormData($loginForm.get(0))
        $loginForm.submit(function (e) {
            e.preventDefault();

            abp.ui.setBusy(
                null,
                abp.ajax({
                    contentType: false,
                    processData: false,
                    url: $loginForm.attr('action'),
                    data: formdata.serialize()
                })
            );
        });

view

@using Abp.Application.Services.Dto
@using Clarity.BabcockCRM.Web.Areas.Mpa.Models.Common.Modals
@using Abp.Web.Mvc.Extensions
@using Clarity.BabcockCRM.Authorization
@using Clarity.BabcockCRM.Web.Navigation
@using Clarity.BabcockCRM.Web.Areas.Mpa.Models.Company
@model Clarity.BabcockCRM.Web.Areas.Mpa.Models.Company.Page4ViewModel
@{
    ViewBag.CurrentPageName = PageNames.App.Common.Profile;
}

@section Styles
{

    @Html.IncludeStyle("~/Areas/Mpa/Views/CompanyAdmin/Index.min.css")
    @Html.IncludeStyle("~/libs/jasny-bootstrap/css/jasny-bootstrap.min.css")
    @Html.IncludeStyle("~/libs/bootstrap-datepicker/css/bootstrap-datetimepicker.min.css")
    @Html.IncludeStyle("~/libs/pace/pace-theme-center-radar.css")
}
@section Scripts
{
<script src="~/libs/bootstrap-datepicker/js/bootstrap-datetimepicker.min.js"></script>
    @Html.IncludeScript("~/libs/jasny-bootstrap/js/jasny-bootstrap.min.js")
    @Html.IncludeScript("~/libs/bootstrap-datepicker/js/bootstrap-datetimepicker.min.js")
    @Html.IncludeScript("~/Areas/Mpa/Views/CompanyAdmin/_CompanyDetails.js")
    @Html.IncludeScript("~/libs/pace/pace.min.js")

}
<form class="profile4-form" enctype="multipart/form-data" action="@Url.Action("UpdateProfile4")" method="post">
    @Html.AntiForgeryToken()
    <div id="CompanyDetails">
        <div class="row row-eq-height">
            <div class="portlet light col-lg-9 col-md-12">
                <div class="portlet-body">

                    <div>
                        <p class="list-group-item-text">
                            <h4>My Profile | @Model.UserDetails.CompanyName - @Model.UserDetails.EmailAddress</h4>
                        </p>

                        <div class="form-group">
                            <label>@L("UploadCompanyRegDoc")</label>

                            <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                                <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-default btn-file">
                                    <span class="fileinput-new"><i class="glyphicon glyphicon-open"></i></span><span class="fileinput-exists">Change</span>
                                    <input type="file" name="CompanyRegDoc">
                                </span>
                                <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                            @if (Model.SupplierDetails.SupplierDetail.CompanyRegDocId != null)
                            {
                                @Html.ActionLink("Downlaod", "DownLoadFile", new { id = Model.SupplierDetails.SupplierDetail.CompanyRegDocId,filename = Model.SupplierDetails.SupplierDetail.CompanyRegDocId + ".pdf" })
                            }
                        </div>
                        <div class="form-group">
                            <label>@L("UploadExperianReport")</label>

                            <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                                <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-default btn-file">
                                    <span class="fileinput-new"><i class="glyphicon glyphicon-open"></i></span><span class="fileinput-exists">Change</span>
                                    <input type="file" name="ExperianReport">
                                </span>
                                <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>@L("UploadSLA")</label>

                            <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                                <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-default btn-file">
                                    <span class="fileinput-new"><i class="glyphicon glyphicon-open"></i></span><span class="fileinput-exists">Change</span>
                                    <input type="file" name="SLA">
                                </span>
                                <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>@L("UploadConfidentialityAgreement")</label>

                            <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                                <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-default btn-file">
                                    <span class="fileinput-new"><i class="glyphicon glyphicon-open"></i></span><span class="fileinput-exists">Change</span>
                                    <input type="file" name="ConfidentialityAgreement">
                                </span>
                                <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>@L("UploadConfidentialityAgreement")</label>

                            <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                                <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-default btn-file">
                                    <span class="fileinput-new"><i class="glyphicon glyphicon-open"></i></span><span class="fileinput-exists">Change</span>
                                    <input type="file" name="ConfidentialityAgreement">
                                </span>
                                <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>@L("UploadCQIDA")</label>

                            <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                                <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-default btn-file">
                                    <span class="fileinput-new"><i class="glyphicon glyphicon-open"></i></span><span class="fileinput-exists">Change</span>
                                    <input type="file" name="CQIDA">
                                </span>
                                <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>@L("UploadPublicLiability")</label>

                            <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                                <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-default btn-file">
                                    <span class="fileinput-new"><i class="glyphicon glyphicon-open"></i></span><span class="fileinput-exists">Change</span>
                                    <input type="file" name="CQIDA">
                                </span>
                                <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                        </div>
                        <div class="form-group">

                            <label for="PaymentTermId">@L("BeeLevel")</label>
                            @Html.DropDownList("BeeLevelId", Model.BeeLevel.Select(i => i.ToSelectListItem()), new { @class = "form-control edited" })

                        </div>
                        <div class="form-group form-md-line-input form-md-floating-label">
                            <input class="form-control placeholder-no-fix" type="text" name="BlackOwnedPercentage" value="@Model.SupplierDetails.SupplierDetail.BlackOwnedPercentage" />
                            <label>@L("BlackOwnedPercentage")</label>
                        </div>
                        <div class="form-group form-md-line-input form-md-floating-label">
                            <input class="form-control placeholder-no-fix" type="text" name="WomanBlackOwnedPercentage" value="@Model.SupplierDetails.SupplierDetail.WomanBlackOwnedPercentage" />
                            <label>@L("WomanBlackOwnedPercentage")</label>
                        </div>
                        <div class="form-group">
                            <label>@L("BeeCertificateExpiryDate")</label>
                            <div class='input-group date' id='BeeCertificateExpiryDate'>
                                <input type='text' class="form-control"name="BeeCertificateExpiryDate" value="@Model.SupplierDetails.SupplierDetail.BeeCertificateExpiryDate" />
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>@L("UploadBeeCertificate")</label>

                            <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                                <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-default btn-file">
                                    <span class="fileinput-new"><i class="glyphicon glyphicon-open"></i></span><span class="fileinput-exists">Change</span>
                                    <input type="file" name="BeeCertificate">
                                </span>
                                <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                        </div>
                        <div class="md-checkbox-list">

                            <div class="md-checkbox">

                                <input id="VatRegistered" class="md-check" type="checkbox" name="IsVatRegistered" value="true" @(Model.SupplierDetails.SupplierDetail.IsVatRegistered ? "checked=\"checked\"" : "")>
                                <label for="VatRegistered">
                                    <span class=""></span>
                                    <span class="check"></span>
                                    <span class="box"></span>
                                    @L("VatRegistered")
                                </label>
                            </div>
                        </div>
                        <div class="form-group form-md-line-input form-md-floating-label">
                            <input class="form-control placeholder-no-fix" type="text" name="VatRegistrationNumber" value="@Model.SupplierDetails.SupplierDetail.VatRegistrationNumber" />
                            <label>@L("VatRegistrationNumber")</label>
                        </div>
                        <div class="md-checkbox-list">

                            <div class="md-checkbox">

                                <input id="TaxClearance" class="md-check" type="checkbox" name="HasTaxClearanceCertificate" value="true" @(Model.SupplierDetails.SupplierDetail.HasTaxClearanceCertificate ? "checked=\"checked\"" : "")>
                                <label for="TaxClearance">
                                    <span class=""></span>
                                    <span class="check"></span>
                                    <span class="box"></span>
                                    @L("TaxClearanceCertificate")
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>@L("TaxClearanceExpiryDate")</label>
                            <div class='input-group date' id='BeeCertificateExpiryDate'>
                                <input type='text' class="form-control" name="TaxClearanceCertificateExpiryDate" value="@Model.SupplierDetails.SupplierDetail.TaxClearanceCertificateExpiryDate" />
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>@L("UploadTaxClearanceCertificate")</label>

                            <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                                <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-default btn-file">
                                    <span class="fileinput-new"><i class="glyphicon glyphicon-open"></i></span><span class="fileinput-exists">Change</span>
                                    <input type="file" name="TaxClearanceCertificate">
                                </span>
                                <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                        </div>
                        <div class="md-checkbox-list">

                            <div class="md-checkbox">

                                <input id="QualityAudit" class="md-check" type="checkbox" name="HasQualityAudit" value="true" @(Model.SupplierDetails.SupplierDetail.HasQualityAudit ? "checked=\"checked\"" : "")>
                                <label for="QualityAudit">
                                    <span class=""></span>
                                    <span class="check"></span>
                                    <span class="box"></span>
                                    @L("QualityAudit")
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>@L("QualityAuditDate")</label>
                            <div class='input-group date' id='BeeCertificateExpiryDate'>
                                <input type='text' class="form-control" name="QualityAuditExpiryDate" value="@Model.SupplierDetails.SupplierDetail.QualityAuditExpiryDate" />
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>@L("UploadQualityAuditReport")</label>

                            <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                                <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-default btn-file">
                                    <span class="fileinput-new"><i class="glyphicon glyphicon-open"></i></span><span class="fileinput-exists">Change</span>
                                    <input type="file" name="QualityAuditReport">
                                </span>
                                <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                        </div>
                        <div class="md-checkbox-list">

                            <div class="md-checkbox">

                                <input id="VendorAudit" class="md-check" type="checkbox" name="HasVendorAudit" value="true" @(Model.SupplierDetails.SupplierDetail.HasVendorAudit ? "checked=\"checked\"" : "")>
                                <label for="VendorAudit">
                                    <span class=""></span>
                                    <span class="check"></span>
                                    <span class="box"></span>
                                    @L("VendorAudit")
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>@L("HasVendorAuditDate")</label>
                            <div class='input-group date' id='BeeCertificateExpiryDate'>
                                <input type='text' class="form-control" name="VendorAuditExpiryDate" value="@Model.SupplierDetails.SupplierDetail.VendorAuditExpiryDate" />
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>@L("UploadVendorAuditReport")</label>

                            <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                                <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-default btn-file">
                                    <span class="fileinput-new"><i class="glyphicon glyphicon-open"></i></span><span class="fileinput-exists">Change</span>
                                    <input type="file" name="VendorAuditReport">
                                </span>
                                <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="PaymentTermId">@L("ContractedSupplier")</label>
                            @Html.DropDownList("ContractedSupplierId", Model.ContractedSupplier.Select(i => i.ToSelectListItem()), new { @class = "form-control edited" })
                        </div>
                        <div class="form-group">
                            <label>@L("UploadTransportSolutions")</label>

                            <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                                <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-default btn-file">
                                    <span class="fileinput-new"><i class="glyphicon glyphicon-open"></i></span><span class="fileinput-exists">Change</span>
                                    <input type="file" name="TransportSolutions">
                                </span>
                                <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>@L("UploadPowerGeneration")</label>

                            <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                                <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-default btn-file">
                                    <span class="fileinput-new"><i class="glyphicon glyphicon-open"></i></span><span class="fileinput-exists">Change</span>
                                    <input type="file" name="PowerGeneration">
                                </span>
                                <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                        </div>
                        <input type="hidden" name="SupplierDetailId" value="@Model.SupplierDetails.SupplierDetail.Id" />
                        <div class="form-actions">
                            <button type="submit" id="register-submit-btn" class="btn btn-success uppercase pull-right">@L("Next")</button>
                        </div>
                    </div>

                </div>
            </div>
            <div class="col-lg-3 col-md-12 info-sidebar">
                <div><img src="~/Content/images/Steps-01.png" width="100" /></div>
                <div class="info-block">
                    <i class="fa fa-folder-open fa-4x"></i>
                    <h4>Documents</h4>
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>
                </div>
            </div>
        </div>
    </div>
</form>

Hi There

I am getting the following issue when deploying to Azure. I am using the MVC 5.x with Jquery version. I am deploying using CI with bitbucket.

Anybody know what the issue is.

D:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets(242,5): warning : No compiler log specified, 'Clean' won't work. [D:\home\site\repository\Clarity.BabcockCRM.Web\Clarity.BabcockCRM.Web.csproj] CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: 'D:\home\site\repository\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll' and 'D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\Facades\System.Xml.ReaderWriter.dll'. Remove one of the duplicate references. [D:\home\site\repository\Clarity.BabcockCRM.Web\Clarity.BabcockCRM.Web.csproj] CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: 'D:\home\site\repository\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll' and 'D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\Facades\System.Runtime.Serialization.Primitives.dll'. Remove one of the duplicate references. [D:\home\site\repository\Clarity.BabcockCRM.Web\Clarity.BabcockCRM.Web.csproj] Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\home\site\repository\Clarity.BabcockCRM.Web\Clarity.BabcockCRM.Web.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\8d5065ffbc80fc1";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="D:\home\site\repository.\" An error has occurred during web site deployment. \r\nD:\Program Files (x86)\SiteExtensions\Kudu\65.60901.2996\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

Hi There

I Extended the Jtable user list to include a new action ICompany Profile.

{
                            text: app.localize('CompanyProfile'),
                            visible: function (data) {
                                return data.record.id !== abp.session.userId;
                            },
                            action: function (data) {
                                abp.ajax({
                                    url: abp.appPath + 'Mpa/CompanyAdmin/Index',
                                    data: JSON.stringify({
                                        userId: data.record.id
                                    })
                                });
                            }
                        },

When I click on the action it steps into the controller and passes through the data correctly but when it tries to return the view it does nothing then gives an error. It does not log anything in the logs.

Controller

public async Task<ActionResult> Index(CompanyAdminModel input)
        {
            var businessUnits = await _documentFilterAppService.GetBusinessUnitsForCombobox();
            var userid = input.UserId;
            var UserCustomerNumbers =  _customerNumberAppService.GetCustomerNumbersByUser(userid);
            var userProfile = await _profileAppService.GetCompanyProfileForAdminEdit(userid);
            var model = new IndexViewModel(businessUnits, UserCustomerNumbers, userProfile);
            return View(model);
        }

How to I go to a new view from a jTable action? Technically it would be leaving the user list page and going to the company profile page.

Thanks

Question

Hi There

I am inquiring if anybody has done anything with cascading dropdowns within the ASPNETZERO framework. Especially using the WebUI from javascript.

Any help will be appreciated.

Thanks

Hi There

I am using the regular EF version not core. I have got the following entities.

[Table("BusinessUnits")]
    public class BusinessUnit : FullAuditedEntity
    {
        [Required]
        public string Name { get; set; }
        [Required]
        public string SharepointMapping { get; set; }
    }

  [Table("Brands")]
    public class Brand : FullAuditedEntity
    {
        [Required]
        public string Name { get; set; }
        [Required]
        public string SharepointMapping { get; set; }
        [ForeignKey("BusinesUnitId")]
        public virtual BusinessUnit BusinessUnit { get; set; }
        public virtual int BusinesUnitId { get; set; }

    }

 [Table("Products")]
    public class Product : FullAuditedEntity
    {
        [Required]
        public string Name { get; set; }
        [Required]
        public string SharepointMapping { get; set; }
        [ForeignKey("BrandId")]
        public virtual Brand Brand { get; set; }
        public virtual int BrandId { get; set; }

    }

The navigation properties - lazy loading works for the first two entities but when I try list the Products Entity from a webservice call I get the following error.

{"message":"An error has occurred.","exceptionMessage":"The 'ObjectContent1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.","exceptionType":"System.InvalidOperationException","stackTrace":null,"innerException":{"message":"An error has occurred.","exceptionMessage":"Error getting value from 'BusinessUnit' on 'System.Data.Entity.DynamicProxies.Brand_486DF76111C074CB5B97521E6C0339967681A92DC158A5A4CBD2B5E9A75D0277'.","exceptionType":"Newtonsoft.Json.JsonSerializationException","stackTrace":" at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)\r\n at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)\r\n at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content)\r\n at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.WebHost.HttpControllerHandler.<WriteBufferedResponseContentAsync>d__1b.MoveNext()","innerException":{"message":"An error has occurred.","exceptionMessage":"The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.","exceptionType":"System.ObjectDisposedException","stackTrace":" at System.Data.Entity.Core.Objects.ObjectContext.get_Connection()\r\n at System.Data.Entity.Core.Objects.ObjectQuery1.GetResults(Nullable1 forMergeOption)\r\n at System.Data.Entity.Core.Objects.ObjectQuery1.Execute(MergeOption mergeOption)\r\n at System.Data.Entity.Core.Objects.DataClasses.EntityReference1.Load(MergeOption mergeOption)\r\n at System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.DeferredLoad()\r\n at System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.LoadProperty[TItem](TItem propertyValue, String relationshipName, String targetRoleName, Boolean mustBeNull, Object wrapperObject)\r\n at System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.<>c__DisplayClass72.<GetInterceptorDelegate>b__2(TProxy proxy, TItem item)\r\n at System.Data.Entity.DynamicProxies.Brand_486DF76111C074CB5B97521E6C0339967681A92DC158A5A4CBD2B5E9A75D0277.get_BusinessUnit()\r\n at GetBusinessUnit(Object )\r\n at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)"}}}

Here is the service that is being used for the lookup.

var products = _productRepository.GetAll().ToList();

Is there an issue with getting entities 3 levels deep.

Thanks

Showing 1 to 10 of 12 entries