×

Notice

The forum is in read only mode.
×
Getting new Releases

To get notified on new releases you may follow us on twitter @expandframework or subscribe in our main RSS feed.

Topic-icon XpandNavigationItemAttribute add property for "node id "

  • K1
  • K1's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
5 months 3 weeks ago #11533 by K1
Currently the generated IModelNavigationItem id and caption are same

I suggest that 'id' can be customized and can be provided in XpandNavigationItemAttribute constructor.

Example
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)]
    public class XpandNavigationItemAttribute : Attribute, ISupportViewId {
		readonly int _index = -1;
        readonly string _path;
        readonly string _viewId;

        public XpandNavigationItemAttribute(string path, string viewId=null, int index = -1) 
		: this(path, viewId, null, index) {}

        public XpandNavigationItemAttribute(string path, string viewId, string objectKey, int index = -1) {
            _path = path;
            _viewId = viewId;
            _index = index;
            ObjectKey = objectKey;
			
			var paths = _path.Split('/');
			Id = paths[0];
        }
        
		public XpandNavigationItemAttribute(string path, string viewId, string objectKey,  string id, int index = -1) {
            _path = path;
            _viewId = viewId;
            _index = index;
            ObjectKey = objectKey;
			Id =  id;
        }
		
		public string Id { get; set; }
		
        public int Index {
            get { return _index; }
        }

        public string Path {
            get { return _path; }
        }

        public string ObjectKey { get; set; }

        public string ViewId {
            get { return _viewId; }
        }
    }


Then XpandNavigationItemNodeUpdater we simply use the Id
More
5 months 3 weeks ago #11536 by Tolis
thnks for the suggestion I will come back as soon as I review it

To get notified on new releases follow us on twitter @expandframework or subscribe RSS feed. I am also available @tolisss . Also see How to debug eXpand
More
5 months 3 weeks ago #11539 by Tolis
what's the reasoning behind

Id = paths[0];

don't you think

id = paths.Last()

is a better candidate?

To get notified on new releases follow us on twitter @expandframework or subscribe RSS feed. I am also available @tolisss . Also see How to debug eXpand
  • K1
  • K1's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
4 months 2 weeks ago - 4 months 2 weeks ago #11628 by K1

Tolis wrote: what's the reasoning behind

Id = paths[0];

don't you think

id = paths.Last()

is a better candidate?


Thanks for you correction, Actually I will tell you a secret : I didn't test the code I just wrote it in text editor to illustrate the idea :blush:
Last edit: 4 months 2 weeks ago by K1.
More
4 months 2 weeks ago #11630 by Tolis
no worries feel free to post your ideas

To get notified on new releases follow us on twitter @expandframework or subscribe RSS feed. I am also available @tolisss . Also see How to debug eXpand
Moderators: expand
Time to create page: 0.283 seconds