Skip to main content



No record found.

Dynamics 365 Community / Forums / Commerce forum / How create Data Model ...
Commerce forum

How create Data Model in MPOS D365 F&O

Posted on by 15


public int DayOfWeek
get { return (int)this[DayColumn]; }
set { this[DayColumn] = value; }

/// <summary>
/// Gets or sets the open time.
/// </summary>
public int OpenTime
get { return (int)this[OpenTimeColumn]; }
set { this[OpenTimeColumn] = value; }

/// <summary>
/// Gets or sets the closing time.
/// </summary>
public int CloseTime
get { return (int)this[CloseTimeColumn]; }
set { this[CloseTimeColumn] = value; }

/// <summary>
/// Gets or sets the id.
/// </summary>
public long Id
get { return (long)this[IdColumn]; }
set { this[IdColumn] = value; }


code above, how to generate it ?, Can it be generated directly from the database / tool or only write from scratch?


Regrds. F20

  • Verified answer
    Ramshenkar Profile Picture
    Ramshenkar on at
    RE: How create Data Model in MPOS D365 F&O

    It really does not need to be much complex as shown in sample extension.  Refer below simplified form of your code.  Whats important is [DataMember attribute for each property and  [Key attribute for primary property. 

    class Storehour
    public int DayOfWeek { get; set; }
    public int OpenTime { get; set; }
    public int CloseTime { get; set; }
    public long Id { get; set; } 

    You can generate it using visual studio past special command, if you have JSON or XML data string. For example I have below json string - 

    {"balance": 1000.21, "num":100, "is_vip":true, "name":"foo"}

    Copy it and open a empty c# class, use visual studio menu "Edit-> Paste Special -> Paste JSON as Class". It will create below structure for you. Decorate it with attribute and that's it. You can also use XML string to generate the class.  

    public class Rootobject
    public float balance { get; set; }
    public int num { get; set; }
    public bool is_vip { get; set; }
    public string name { get; set; }

    Hope it helps you. 



Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans