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

  • Home
  • SEARCH
  • 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 8360753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:32:35+00:00 2026-06-09T11:32:35+00:00

In classes whose instances I persist using an object database, I keep having to

  • 0

In classes whose instances I persist using an object database, I keep having to do this:

private string _name;
public string Name
    {
    get { return this._name; }
    set { _name = value; this.Save(); }
    }

whereas I would much rather type this:

[PersistedProperty(Name)]
private string _name;

where the PersistedProperty attributes generates a Getter and Setter just like the default [Property()] attribute, except I want to add a line of code to the generated Setter.

Is there a way I can create an attribute which does this? Hopefully , which works with Intellisense.

How does the default [Property()] attribute even do it’s stuff? If I saw the code I could graft that…

Note: I am actually doing this in Boo, but thought I’d give c# code as more people might be willing to answer that, however, if there is a Boo specific solution, I’m all ears!

Update:

My aim was simply to reduce typing and clutter. It turns out the simplest way of doing this was with a script which generates partial classes based on markup in my classes.

Auto-generating source code from markup (in tandem with partial classes) is easy, and actually looks like an extremely promising way to get round some of the problems we normally try to solve with inheritance and generic types.

  • 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-09T11:32:37+00:00Added an answer on June 9, 2026 at 11:32 am

    This requires aspect oriented programming. While not directly supported in .NET, it can be done via third party tooling, such as PostSharp.

    For intellisense to work, however, this must be done in a library, as the (final) compiled code will be unrolled into the full property getter/setter.

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

Sidebar

Related Questions

classes: public abstract class BaseHolidayPackageVariant { private Integer variantId; private HolidayPackage holidayPackage; private String
Given the following classes: public class Nation { public string Name { get; set;
I have 2 classes whose object should act as partners. The first one is
I'm trying to do the following, define two classes whose instances mutually reference one
Session contains objects whose class definition isn\'t available. Remember to require the classes for
How to write a template, that would take as argument classes, whose constructors have
Classes that implement IEnumerable and provide a public void Add(/* args */) function can
Naming classes is sometimes hard. What do you think name of the class should
I have a few classes that define sequences whose values must be available both
In our system, we have a number of classes whose construction must happen asynchronously.

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.