Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "jcompagnon"

Hi alirizaadiyahsi,

While running application with my device connected via USB, I tried opening a browser and going to the LocalhostIp set (by itself and with the port of the host :22742) but it was not able to connect.

I confirmed that there is nothing in place blocking the USB from extending connections to external devices and turned off all settings of the Windows Defender Firewall to make sure it wasn't that firewall blocking either.

Hello Alper!

Thanks for the suggestion. It does work when listed as its own site; my issue is that we're trying to have the app hosted under the same site as other projects - something like <a class="postlink" href="http://www.mydomain.com/">www.mydomain.com/</a>[project]. As we deal with many projects, we would like to keep this format consistent, if possible.

After publishing to a directory exposed through IIS, trying to run the app loads the login page - but all of the resources (script, style, images, etc) return 404s, since they're expecting the "view-resources", etc, to be available at the site root - rather than at /[project]/.

I was wondering if there was a central way to update what the app believed was site root, instead of having to update every reference to a resource.

Do you have any hints as to how I might accomplish this, or a direction in which I can look?

Hello,

According to the docs, the ApplicationPath has no setter; from the source, it looks like it's configured to return "/" by default. Should I just be creating a new Getter at this level, providing the project name we expect to see? Is that going to break other components?

Thank you for your help!

An update:

For now I've put the function in the AppServiceBase class in the application layer. I'm sure I'm breaking a whole lot of Best Practices, but as a rough draft / proof of concept:

public abstract class FirstASPNetZeroAppServiceBase : ApplicationService
    {
        private static readonly FirstASPNetZeroDbContext _dbContext = new FirstASPNetZeroDbContext();
        private static readonly object _dbContextLock = new object();

        protected FirstASPNetZeroDbContext DBContext
        {
            get
            {
                lock (_dbContextLock)
                {
                    return _dbContext;
                }
            }
        }
protected virtual List<Dictionary<string, object>> QueryDynamicData(string table, int entityID)
        {
            try
            {
                //Get the table desired based on the table name passed
                PropertyInfo dbSetInfo = DBContext.GetType().GetProperties().FirstOrDefault(p => p.Name.ToLower().Equals(table.ToLower()));

                //Return all results from the table into IQueryable set where Id = entityID passed
                IQueryable anyDbSet = ((IQueryable)dbSetInfo.GetValue(DBContext)).Where("Id=" + entityID);

                List<Dictionary<string,object>> listObjects = new List<Dictionary<String, Object>>();

                //Iterate through results
                foreach (Object entity in anyDbSet)
                {
                    //Create dictionary of Field Name, Field Value from results
                    Dictionary<string, object> listDBValues = entity.GetType().GetProperties().ToDictionary(propertyInfo => propertyInfo.Name, propertyInfo => propertyInfo.GetValue(entity));

                    //Add dictionary to list of dictionaries - useful for returning list of found results instead of just one
                    listObjects.Add(listDBValues);
                }

                //Return list of dictionaries
                return listObjects;
            }
            catch (Exception e) { }
            return null;
        }protected virtual List<Dictionary<string, object>> QueryDynamicData(string table, int entityID)
        {
            try
            {
                //Get the table desired based on the table name passed
                PropertyInfo dbSetInfo = DBContext.GetType().GetProperties().FirstOrDefault(p => p.Name.ToLower().Equals(table.ToLower()));

                //Return all results from the table into IQueryable set where Id = entityID passed
                IQueryable anyDbSet = ((IQueryable)dbSetInfo.GetValue(DBContext)).Where("Id=" + entityID);

                List<Dictionary<string,object>> listObjects = new List<Dictionary<String, Object>>();

                //Iterate through results
                foreach (Object entity in anyDbSet)
                {
                    //Create dictionary of Field Name, Field Value from results
                    Dictionary<string, object> listDBValues = entity.GetType().GetProperties().ToDictionary(propertyInfo => propertyInfo.Name, propertyInfo => propertyInfo.GetValue(entity));

                    //Add dictionary to list of dictionaries - useful for returning list of found results instead of just one
                    listObjects.Add(listDBValues);
                }

                //Return list of dictionaries
                return listObjects;
            }
            catch (Exception e) { }
            return null;
        }

I posted the question on Stack Overflow and got some good answers. <a class="postlink" href="https://stackoverflow.com/questions/46285519/query-an-entity-framework-entity-without-knowing-the-object-type-class-table-i">https://stackoverflow.com/questions/462 ... ss-table-i</a>

I'm wondering now where would I put such a function?

I've tried adding it to the ProjectRepositoryBase.cs where it says to add common methods:

public abstract class FirstASPNetZeroRepositoryBase<TEntity, TPrimaryKey> : EfRepositoryBase<FirstASPNetZeroDbContext, TEntity, TPrimaryKey>
        where TEntity : class, IEntity<TPrimaryKey>
    {
        protected FirstASPNetZeroRepositoryBase(IDbContextProvider<FirstASPNetZeroDbContext> dbContextProvider)
            : base(dbContextProvider)
        {

        }

        //add your common methods for all repositories
        public object[] QueryDynamicData(string table, int entityID)
        {
            try
            {
                
            }catch(Exception e) { }
            return null;
        }
    }

However, when I go to an AppService class, I cannot access that method from the repository (_patientRepository will not find method QueryDyanmicData() from above)

public class PatientAppService : FirstASPNetZeroAppServiceBase, IPatientAppService
    {
        private readonly IRepository<PatientItem> _patientRepository;

        public PatientAppService(IRepository<PatientItem> patientRepository)
        {
            _patientRepository = patientRepository;
        }

        public async Task<PagedResultDto<PatientListDto>> GetPatientsForGrid(GetPatientsInput input)
        {
            _patientRepository
//...other code

Thanks!

I have done some googling, but nothing useful so far has come up. I've posted a question on Stack Overflow, we'll see if anything comes of it.

Thanks for your input!

Thanks, that worked!

Hello,

Thank you for the response; I've just sent along an email.

Hello,

Thank you for looking into this.

Currently in my solution, FirstASPNetZero is the starter solution - the ASPNET Zero template. In it, I'm using the "Mpa" area to test out some of the features of ABP & ASPNet Zero, while in the solution, I've also added other projects while trying to learn about the module system. To that end, I have in the solution a folder for "Announcements", which contains the various layers of that module (Announcements.Web, Announcements.Application, etc). I then made my main module, FirstASPNetZeroWebModule, depend on the AnnouncementsWebModule.

Here's a screenshot of my current solution: [attachment=0:1vfbwr5d]AnnouncementsModuleScreenCap.PNG[/attachment:1vfbwr5d]

I'm sure this is something trivial that I'm just not understanding, but I've been wracking my head trying to figure it out and not making much progress. Any help would be appreciated!

Thanks again,

Hello,

Are there any updates on this?

Showing 11 to 20 of 31 entries