Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8400047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:27:50+00:00 2026-06-09T21:27:50+00:00

What is the best practice to define service call prototype/signature while developing application in

  • 0

What is the best practice to define service call prototype/signature while developing application in service oriented architecture.

For Example I want to create Service call to send email.

Let say I have following object in my domain layer

 [datacontract]
public class Email
{
      public string To { get; set; }
      public string From { get; set; }
      public string Message { get; set; }
      public string Subject { get; set; }

      //I am not going to use this properties in send email method
      public string OtherProp1 {get; set;}
      public string OtherProp2 {get; set;}
      public string OtherProp3 {get; set;}

  }

Should I create Service method signature like

   public bool SendEmail(string from,string to, string subject,string message){//My Logic}}

Or

   public bool SendEmail(Email myEmail){//My Logic}

I am leaning toward first option.(Having said that I know if object is way to complex than it make sense to pass whole object itself.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:27:52+00:00Added an answer on June 9, 2026 at 9:27 pm

    Unfortunately, second option is less clear in this case and this is because of your Email class.

    Suppose I am to call your method. You make me pass an instance of the Email class. I go to the class contract and find 7 properties.

    And, how am I supposed to know which parameters are mandatory and which are optional? From the docs? Not a cleanest design if I have to consult the docs to make proper use of the API.

    I would rather refactor your Email class to call it EmailRequest with all these optional parameters removed and then I would create yet another class EmailResponse if you ever need to use it as a return value of a service.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the best architecture to perform custom operations (application-level) at an interval? Define
What is considered best practice deciding how to define the set of JAR's for
The 'best practice' (as I see it) to atomically create a new file, is
Is there a best practice for making an entity immutable? Users create exercises in
What is considered best practice when referring to a program's name? I've seen: #define
FactoryGirl won't set my protected attribute user.confirmed . What's the best practice here? Factory.define
I am trying to find a best-practice to allow users to define the route
I would like to define a best practice for storing timestamps in my Postgres
I know interfaces cannot define constructors. What is the best practice to force all
Does someone knows C# best practice about the way to define attribute visibility (private

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.