DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • Developing and Deploying ASP.NET Core and Entity Framework Core for Azure
  • A Guide to Enhanced Debugging and Record-Keeping
  • New ORM Framework for Kotlin
  • Build a Full Stack App With SvelteKit and OceanBase

Trending

  • Securing Your Applications With Spring Security
  • The Ultimate Guide to API vs. SDK: What’s the Difference and How To Use Them
  • How To Aim for High GC Throughput
  • New Free Tool From Contrast Security Makes API Security Testing Fast and Easy
  1. DZone
  2. Coding
  3. Frameworks
  4. Review: S#arp Lite, a Lightweight Framework for Delivering ASP.NET MVC Solutions (Part 2) - the domain

Review: S#arp Lite, a Lightweight Framework for Delivering ASP.NET MVC Solutions (Part 2) - the domain

Oren Eini user avatar by
Oren Eini
·
Mar. 02, 12 · News
Like (0)
Save
Tweet
Share
4.28K Views

Join the DZone community and get the full member experience.

Join For Free

this is a review of the s#arp lite project , the version from nov 4, 2011.

in my previous post, i looked at the general structure, but not much more. in this one, we are going to focus on the domain project.

we start with the actual domain:

image

i have only few comments about this sort of model:

  • this is a pure crud model, which is good, since it is simple and easy to understand, but one does wonder where the actual business logic of the system is. it might be that there isn’t any (we are talking about a sample app, after all).
  • the few methods that are there are also about data (in this case, aggregation, and order.gettotal() will trigger a lazy loaded query when called, which might be a surprise to the caller.
  • probably the worst point of this object model is that it is highly connected , which encourages people to try to walk the object graphs where they should issue a separate query instead.

next, let us look at the queries. we have seen one example where nhibernate low level api was hidden behind an interface, but that was explicitly called out as rare. so how does this get handled on a regular basis?

image

hm… i have some issues here with regards to the naming. i don’t like the “find” vs. “query” naming. i would use wherexyz to add a filter and selectxyz to add a transformation. it would read better when writing linq queries, but that is about it for the domain.

one thing that i haven’t touched so far is the entities base class:

image

and its parent:

image

i strongly support the notion of comparableobject, this is recommended when you use nhibernate. but what is it about gettypespecificsignatureproperties? what it actually does is select all the properties that has the [domainsignature] attribute. but what would you want something like that?

looking at the code, the customer.firstname and customer.lastname have this attribute, looking at the code, i really can’t understand what went on here. this seems to be selected specifically to create hard to understand and debug bugs.

why do i say that? the comparableobject uses properties marked with [domainsignature] for the gethashcode() calculation. what this means is that if you change the customer name you change its hash code value . this hash code value is used for, among other things, finding the entity in the unit of work, so changing the customer name can cause nhibernate to loose track of it and behave in some really strange ways.

this is also violating one of the core principals of entities :

a thing with distinct and independent existence.

in other words, an entity doesn’t exists because of the particular values that are there for the first and last names. if those change, the customer doesn’t change. it is the same as saying that by changing the shirt i wear, i becomes a completely different person.

domain signature is something that i am completely opposed, not only for the implementation problems, but because it has no meaning when you start to consider what an entity is .

next, we are going to explore tasks.

ASP.NET MVC ASP.NET Database Framework

Published at DZone with permission of Oren Eini, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Developing and Deploying ASP.NET Core and Entity Framework Core for Azure
  • A Guide to Enhanced Debugging and Record-Keeping
  • New ORM Framework for Kotlin
  • Build a Full Stack App With SvelteKit and OceanBase

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: