Home > database >  C# - WCV using class from .net core project
C# - WCV using class from .net core project

Time:04-25

I have some problem with my project, i'm making application in .net core but i also need to create api, i want to make "wcf service" and now i can't use class from other project in solution becouse wcf is in .net framework :\ example below.

namespace Example.Data //This is class library
{
    public class Assortment:MainFields
    {
        public string Code { get; set; }

        public string EANCode { get; set; }
    }
}

namespace WcfService1 //This is wcf service
{
    public class Service1 : IService1
    {
        public string ReturnAssortmentWithEanCode(string EANCode)
        {
            return (new Assortment(EANCode, "Test"));
        }
    }
}

In WcfService1 i can't use "Using Example.Data;"

CodePudding user response:

CoreWCF supports WCF servers on .net core. It is still currently in preview as of this month (April 2022).

CodePudding user response:

I think you can look at the usage of wcf,
you can define in IService1.cs and then use .net core as client to communicate with WCF service.

For .NET Core projects, you can use the Connected Services node in Solution Explorer to access the Microsoft WCF Web Service Reference Provider, which lets you manage Windows Communication Foundation (WCF) data service references.
To add a reference to a service in the current solution (.NET Core projects))

  • Related