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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:37:40+00:00 2026-06-14T13:37:40+00:00

I am using Massive micro-orm and SQL server 2008R2 with .NET framework 4.0. //

  • 0

I am using Massive micro-orm and SQL server 2008R2 with .NET framework 4.0.

// This is my model
    public class sUser : DynamicModel
    {
      public sUser() : base(Model.strConnection, "Users", "UserId") { }
    }

and another class…

    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Linq;
    using System.Web;
    using System.Xml;
    using System.Dynamic;
    using System.Collections.Generic;
    using Massive;

    public class Test
    {
    public dynamic GetUser(string uName)
    {
        dynamic table = new sUser();
        var objUser = table.FindBy(UserName: uName);

        //Tried following...
       //var objUser = new sUser().All().Where(u => u.UserName.ToString() == uName).FirstOrDefault();
    //var objUser = new sUser().All().Where(u => u.UserName.ToString().Equals(uName)).FirstOrDefault();

        return objUser;
    }

    public void GetSomething(dynamic testObj, string user)
{
    dynamic User = GetUser(user);

      //testObj.CUser = User["FirstName"] + ' ' + User["LastName"];
      //Would like to access User object like
      //User.FirstName or User["FirstName"]

      //And not like this...
            foreach (var item in User)
            {
                testObj.CUser = item.FirstName + ' ' + item.LastName;
            }
}
}

I would like to access User dynamic object like User.FirstName or User[“FirstName”].
It is possible, or am I missing something?

Any input is highly appreciated.

Thanks.

  • 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-14T13:37:41+00:00Added an answer on June 14, 2026 at 1:37 pm

    You will have to use First method instead of findby

    Them you will be able to access properties like this:

    testObj.CUser = User.FirstName + User.LastName;   
    

    Full working console app:

     class Program
    {
    
        static void Main(string[] args)
        {
            dynamic testObj = new ExpandoObject();
            test t = new test();
            t.GetSomething(testObj, "TestUserName");
            Console.WriteLine(testObj.CUser);
            Console.ReadLine();
        }
    
    }
    public class test
    {
        // This is my model
        public class sUser : DynamicModel
        {
            public sUser()
                : base("test",
                        "Users",
                        "UserId") { }
        }
        public void GetSomething(dynamic testObj, string user)
        {
            dynamic User = GetUser(user);
            testObj.CUser = User.FirstName + User.LastName;
    
        }
        public dynamic GetUser(string uName)
        {
            dynamic table = new sUser();
            var objUser = table.First(UserName: uName);
    
            return objUser;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any examples out there using Massive with SQL Server Compact 4.0 ?
Using Rob Conery's Massive micro-ORM; is it possible to work with tables that have
Using SQL Server 2008 R2 we are looking for a way to select the
Here on this page, Scott Hanselman shows two examples from Micro-ORMs Dapper and Massive,
I have a massive GWT project with using of spring framework. It's running on
I'm using Rob Conery's Massive ORM, and I haven't been able to bind the
I have recently been playing with Massive, a Micro-ORM which returns collections of IEnumerable<dynamic>.
I get this horrible massive error when trying to plot using matplotlib: Traceback (most
I'm trying to parse through some massive SQL query logs using sed and want
I have been using massive Massive Lib (github) for asp.net 4 project. I have

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.