Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have an API that I am working on with a package installed that has a library with CrmEntity and D365Field. I have never worked with API in C# before. I have to remove everything in the package and convert the current code to still run the same. Need help on where to start or how it should look. If I remove CrmEntity and D365Field, What can I use to still get the data from D365 to the JSON I have for this program?

C#
<pre>using OneDigital.WebApi.HttpClient.Lib.D365Entity;
using OneDigital.WebApiHttpClient.Models;

namespace BenchMarkingAPITab.Models
{
    public class Company : CrmEntity
    {
        public override string D365EntityName => "account";

        [D365Field(name: "accountid")]
        public override Guid CrmId { get; set; }

        [D365Field(name: "name")]
        public string? CompanyName { get; set; }

        [D365Field(name: "parentaccountid", isForeignKey: true, dataBindEntity: "account")]
        public Guid? ParentAccountId { get; set; }

        [D365Field(name: "parentaccountid", isForeignKey: true, dataBindEntity: "account", useFormattedValue: true)]
        public string? ParentAccountName { get; set; }

        [D365Field(name: "digins_companytype")]
        public int CompanyTypeId { get; set; }

        [D365Field(name: "digins_companytype", useFormattedValue: true)]
        public string? CompanyTypeName { get; set; }

        [D365Field(name: "digins_effectivedate")]
        public DateTime? EffectiveDate { get; set; }

        [D365Field(name: "NumberOfEmployees")]
        public int NumberOfEmployees { get; set; }

        [D365Field(name: "digins_stateid", useFormattedValue: true, dataBindEntity: "digins_stateid")]
        public Guid? StateName { get; set; }

        [D365Field(name: "digins_stateid", useFormattedValue: true)]
        public string? State { get; set; }

        [D365Field(name: "digins_industryid", isForeignKey: true, dataBindEntity: "digins_industry", fieldSchemaName: "digins_IndustryId")]
        public Guid? Industry { get; set; }

        [D365Field(name: "digins_sic", isForeignKey: true, dataBindEntity: "SIC/NAICS Code", useFormattedValue: true)]
        public int IndustryCode { get; set; }

        [D365Field(name: "adx_partner_status", useFormattedValue: true)]
        public string? Partner { get; set; }

        [D365Field(name: "OwnerId", useFormattedValue: true)]
        public string? OwnerId { get; set; }

        [D365Field(name: "AccountCategoryCode")]
        public string? Category { get; set; }
    }

    public class User : CrmEntity
    {
        public override string D365EntityName => "systemuser";

        [D365Field(name: "systemuserid")]
        public override Guid CrmId { get; set; }

        [D365Field(name: "DomainName")]
        public string? UserName { get; set; }

    }

    public class Product : CrmEntity
    {
        public override string D365EntityName => "digins_product";

        [D365Field(name: "digins_productid")]
        public override Guid CrmId { get; set; }

        [D365Field(name: "digins_ProductName")]
        public string? ProductName { get; set; }

        [D365Field(name: "digins_producttype")]
        public string? ProductType { get; set;}

        [D365Field(name: "digins_productplantype")]
        public string? ProductPlanType { get; set; }

    }

    public class PlanDetail : CrmEntity
    {
        public override string D365EntityName => "digins_plandetail";

        [D365Field(name: "digins_plandetalid")]
        public override Guid CrmId { get; set; }

        [D365Field(name: "digins_name")]
        public string? name { get; set; }

        [D365Field(name: "digins_innetwork")]
        public string? Innetwork { get; set; }

        [D365Field(name: "AccountCategoryCode")]
        public string? Category { get; set; }

    }

    public class PlanRate : CrmEntity
    {
        public override string D365EntityName => "digins_planrate";

        [D365Field(name: "digins_planrateid")]
        public override Guid CrmId { get; set; }

        [D365Field(name: "digins_tiertype")]
        public string? TierType { get; set; }

        [D365Field(name: "digins_ratetype")]
        public string? RateType { get; set; }

        [D365Field(name: "TransactionCurrencyId")]
        public int TransactionCurrencyId { get; set; }

        [D365Field(name: "digins_employeerate_money")]
        public int EmployeeRateMoney { get; set; }

        [D365Field(name: "digins_employerrate_money")]
        public int EmployerateMoney { get; set; }

        [D365Field(name: "digins_employeerate_percent")]
        public int EmployeeRatePercent { get; set; }

        [D365Field(name: "digins_employerrate_percent")]
        public int EmployerRatePercent { get; set; }

        [D365Field(name: "digins_contributionunit")]
        public int ContributionUnite { get; set; }

        [D365Field(name: "digins_monthlypremium")]
        public int MonthlyPremium { get; set; }


    }
}


What I have tried:

I have tried to remove the package.
Posted
Updated 22-Feb-24 3:03am
v2
Comments
Richard Deeming 22-Feb-24 4:00am    
"I have to remove everything in the package and convert the current code to still run the same."

What is that supposed to mean? If you "remove everything", then there's nothing that can possibly "still run the same".

Click the green "Improve question" link and update your question to include a clear and complete description of what you are trying to do, what you have tried, and where you are stuck.

1 solution

Your question makes no sense.

After you remove the packages, you're going to have to rewrite the code anyway to remove all the mentions of CrmEntity and D365. There is no getting around that.

Since I have no idea what CrmEntity and D365 do, I cannot comment on what is going to happen when all that code is removed and how it impacts its functionality or your API. It could be that you're going to have to rewrite the thing anyway to replace the lost functionality.
 
Share this answer
 
Comments
Computer Wiz99 22-Feb-24 12:00pm    
Yes @Dave Kreskowiak. That is the part I know but what I was asking, since I never wrote an API in C# before, is what connections or functionality of C# code is used to get data from D365 in C#. What was used before was a library that was created by someone else that has the CrmEntity and D365Field in it.
Dave Kreskowiak 22-Feb-24 12:41pm    
I don't think anyone is going to have any idea, short of the people who own the service you're trying to get data from.

Frankly, if you're removing all the SDK code the vendor is providing to get their data, you're just making your job so much more difficult, and possibly unsupported by the vendor.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900