2 added 118 characters in body
source | link

I have my C# project separated in several projects, so each will become a separate .dll after.

I have one project for my Model and one for my Data. Model is responsible for Business Logic and objects representations of what's in the Data Base. Data is responsible for creating the Data Base and general ORM operations. I also have a Desktop project that uses both Model and Data to interact with the user in a WPF Windows program.

Data has a reference to Model since it needs the objects in Model to create the DB for the ORM.

I wanted to add Business Logic into my models so they can be added to the DB, such as Person.Add() will add that person object instance to the DB, but When I add the Data project to the Model project as a reference Visual Studio says it can't be done since this will make a circular reference (which I agree).

How do you usually treat this cases? Is it there a way to keep this kind of projects decoupled or is it normal to merge Data and Model into one project?

I have my C# project separated in several projects, so each will become a separate .dll after.

I have one project for my Model and one for my Data. Model is responsible for Business Logic and objects representations of what's in the Data Base. Data is responsible for creating the Data Base and general ORM operations.

Data has a reference to Model since it needs the objects in Model to create the DB for the ORM.

I wanted to add Business Logic into my models so they can be added to the DB, such as Person.Add() will add that person object instance to the DB, but When I add the Data project to the Model project as a reference Visual Studio says it can't be done since this will make a circular reference (which I agree).

How do you usually treat this cases? Is it there a way to keep this kind of projects decoupled or is it normal to merge Data and Model into one project?

I have my C# project separated in several projects, so each will become a separate .dll after.

I have one project for my Model and one for my Data. Model is responsible for Business Logic and objects representations of what's in the Data Base. Data is responsible for creating the Data Base and general ORM operations. I also have a Desktop project that uses both Model and Data to interact with the user in a WPF Windows program.

Data has a reference to Model since it needs the objects in Model to create the DB for the ORM.

I wanted to add Business Logic into my models so they can be added to the DB, such as Person.Add() will add that person object instance to the DB, but When I add the Data project to the Model project as a reference Visual Studio says it can't be done since this will make a circular reference (which I agree).

How do you usually treat this cases? Is it there a way to keep this kind of projects decoupled or is it normal to merge Data and Model into one project?

1
source | link

Circular Reference Between Data And Model Classes

I have my C# project separated in several projects, so each will become a separate .dll after.

I have one project for my Model and one for my Data. Model is responsible for Business Logic and objects representations of what's in the Data Base. Data is responsible for creating the Data Base and general ORM operations.

Data has a reference to Model since it needs the objects in Model to create the DB for the ORM.

I wanted to add Business Logic into my models so they can be added to the DB, such as Person.Add() will add that person object instance to the DB, but When I add the Data project to the Model project as a reference Visual Studio says it can't be done since this will make a circular reference (which I agree).

How do you usually treat this cases? Is it there a way to keep this kind of projects decoupled or is it normal to merge Data and Model into one project?