Base solution for your next web application

Activities of "codemonkey21"

Okay, I found a Logs.txt in my project, but it seems like it's in the wrong spot.

project.web/bin/debug/net461/win7-x64/App_Data/Logs.txt

but I assumed it would be at project.web/App_Data/Logs.txt

I'm just running locally from Visual Studio. I'm using VS Express 2015 and run as admin.

I'm also seeing a fair amount in the output console of VS with missing PBDs and the following;

Exception thrown: 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' in Microsoft.CSharp.dll Exception thrown: 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' in Microsoft.CSharp.dll

I restarted my project on a fresh core template (v 1.4.2 at the time of download). It appears that that it should in theory write logs out of the box, however no log file has been generated. I've attemped to manually write to the log calling the Logger in an app service and that also does not generate any results. Now that I need to debug, I desperately need the log file.

I even tried to manually create a default blank logs.txt file.

project.web references are; abp.castle.log4net (1.4.2) castle.loggingfacility.mslogging (1.1.0)

From project.web startup.cs

public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            //MVC
            services.AddMvc(options =>
            {
                options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
            });

            //Configure Abp and Dependency Injection
            return services.AddAbp<NyxlyWebModule>(options =>
            {
                //Configure Log4Net logging
                options.IocManager.IocContainer.AddFacility<LoggingFacility>(
                    f => f.UseAbpLog4Net().WithConfig("log4net.config")
                );
            });
        }

        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseAbp(); //Initializes ABP framework.

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
            }

            AuthConfigurer.Configure(app, _appConfiguration);

            app.UseStaticFiles();

            //Integrate to OWIN
            app.UseAppBuilder(ConfigureOwinServices);

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "defaultWithArea",
                    template: "{area}/{controller=Home}/{action=Index}/{id?}");

                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            app.UseMiddleware<BeginRequest>(env);
        }

from log4net.config

<?xml version="1.0" encoding="utf-8" ?>
<log4net>
  <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender" >
    <file value="App_Data/Logs/Logs.txt" />
    <appendToFile value="true" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="10" />
    <maximumFileSize value="10000KB" />
    <staticLogFileName value="true" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%-5level %date [%-5.5thread] %-40.40logger - %message%newline" />
    </layout>
  </appender>
  <root>
    <appender-ref ref="RollingFileAppender" />
    <level value="DEBUG" />
  </root>
  <logger name="NHibernate">
    <level value="WARN" />
  </logger>
</log4net>

Let's put it differently... Like in a real world scenario.

Today I ordered a pizza from a venue called Famous Pizza in my town and it was horrible. I have heard about this website where I can write reviews about restaurants. So I join the web site (host user) because I want to write a review about how bad the pizza was at Famous Pizza. So I search my town and don't find the venue "Famous Pizza". The site suggests to create the venue. I create the venue and write my review. Life goes on, I invite my friends to join the web site, etc.

Some undetermined time later, the owner of Famous Pizza hears about the website and sees all these reviews about their pizza shop. So they join the website (business user / tenant user) and create a business account (tenant). In turn they 'claim' their venue thru some validation method (phone / email / etc). They now can edit the profile for their pizza place and respond to the reviews that customers are leaving on their profile. But maybe Famous Pizza is a chain and they have multiple pizza venues to claim. Using editions, they could upgrade their account to manage several venues. Maybe provide each general manager of a pizza parlor it's own login (tenant user) to respond to reviews in their respective place.

So with this model, most of the users are free to come, browse the site, join, write reviews, add new venues, check in, etc. Business users are tenant users and belong to an account that can claim a venue(s). However, there could be a period of time between the user creating the venue and the venue owner claiming the profile, meaning it wouldn't have a tenant in that time period.

Sorry for the long explaination, but I want to make sure I'm using the interfaces and default tenant as designed or if I have to work a different solution. A perfect example of this model would be <a class="postlink" href="http://www.yelp.com">http://www.yelp.com</a>.

Question

I'm trying to figure out where to assign my web users. I want my site to have several types of users. Think of Yelp.

End users: Every day people signing up and using the site to browse, connect, add venues, write reviews, etc. Business users: Register a business (tenant) and then claim their venue/business.

Should be end user be a host user or a default tenant user? These users search the site for venues and write reviews about them. If the venue does not exist, they can add the venue. A venue entity has the IMayHaveTenant interface. This then throws an exception because my end user is current a Default (tenant id 1) user but the venue has a null tenant id. So there is a mis-match.

When a business claims a venue, the venue then gets a tenant id for that business. Is that going to stop host/default users from viewing and writing reviews on a claimed business?

I guess my question is, should a newly created venue be a host tenant of null or the default tenant of 1 since that's what my end users are. Or do I toss out the interface on the venue entity and skip the data filter. I can create an alternate method to claim a business. Or do my end users all need to be host users?

Sorry that was like six questions. :)

I wanted to figure this out as well, I just haven't jumped into that area of my project yet.

This question is more of a best practice than a code question. It's related to complex or nested entities and if you need a separate service class for each entity or if you should put related managers and methods in the parent/master entity service class? Let me give you some examples;

User: Entity (Parent object) UserImage: Entity (collection) UserCheckIn:Entity (collection) UserActivity:Entity (collection) UserPoints:Entity (collection) Review:Entity (collection)

A user has a collection of images, checkings, activities, points, etc. I know I should create a UserImageManager at the domain level in the Core project, but would you create a UserImageAppService OR put it in the UserAppService since it relates to the User object owns it.

Venue:Entity (Parent object) Review:Entity (collection) ReviewRating:Entity (collection)

Second example. A venue has reviews, reviews have ratings (helpful, not helpful). Would you create a separate ReviewAppService or add a method to the VenueAppService with a ReviewManager reference like _reviewManager.AddReviewToVenue(CreateReviewInput input) since ultimately a review can only belong to one venue.

Just wanted to put out the question and see what other people are doing or how Halil thinks it should work. Most of the examples / samples are too simple compared to real world to figure out best practice.

Thanks!

Maybe we'll see an example of feature management in the EventCloud sample application? :)

All the icons in the navigation provider appear to use Font Awesome. Does this allow the use of a custom icon? If so, how?

<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Navigation">http://www.aspnetboilerplate.com/Pages/ ... Navigation</a>

Bah! I knew it was going to be something simple. Yes, I had made modifications and forgot to call the base...

protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.ComplexType<Address>();
            modelBuilder.Configurations.Add(new CategoryTypeMap());
            modelBuilder.Configurations.Add(new CountryCodeTypeMap());
            modelBuilder.Configurations.Add(new PointsLocationTypeMap());
            modelBuilder.Configurations.Add(new UserActivityTypeMap());
            modelBuilder.Configurations.Add(new UserCheckInTypeMap());
            modelBuilder.Configurations.Add(new UserImageTypeMap());
            modelBuilder.Configurations.Add(new UserPointsTypeMap());
        }
Showing 1 to 10 of 13 entries