Base solution for your next web application

Activities of "tteoh"

<cite>ismcagdas: </cite> Hi,

Please don't take it wrong, I didn't give you any instruction because I don't want to send you on a wrong direction. We don't have very well knowledge on this area. I found this article on the web, <a class="postlink" href="https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/handling-concurrency-with-the-entity-framework-in-an-asp-net-mvc-application">https://docs.microsoft.com/en-us/aspnet ... pplication</a>. It might give you a basic idea in order to complete your work.

Finally, you can do it in a custom repository I think.

Thanks.

Hi, having some guided instructions is always better than none :lol:

That's the same article that I have read and been thinking what's the best way to incorporate the exception handling into AspNet Zero. I shall try out the Custom Repository approach instead of EF-Integration Custom Repository.

Thanks. /Tommy

<cite>tteoh: </cite> If using asp.net zero template, by default, the server is running on UTC.

Global.asax.cs is set with Clock.Provider = ClockProvders.Utc

To use local time, the line of code to be removed according to the code comments.

This seems to be different from the online documentation for ASP.NET ZERO, stating "... default startup solution does not enable UTC datetimes.."

Thanks. /tommy

Correction:

  1. AspNet Zero default setting: Global.asax.cs is set with Clock.Provider = ClockProviders.Utc

  2. Remove or comment the line: System will default to ClockProvider.Unspecified

  3. To use local server time: ClockProvider.Local

My understanding so far.

/tommy

Hi,

Thank you providing the additional reference to UoW implementation in github. Certainly help to save time to look them up otherwise.

To close up the discussion, am I right to understand that if a function implemented within the Domain Service to be executed as UoW, it has to be decorated explicitly as DS by default is not UoW.

Thanks. /tommy

<cite>drcgreece: </cite> Hi Ismail, I ended up with this functional code, in case someone else needs it:

public async Task<DataTable> GetPocPivotQueueAsync(int? tenantId, string filter)
       {
           return await Task.Run(() =>
           {
               return GetPocPivotQueue(tenantId, filter);
           });
       }

       public DataTable GetPocPivotQueue(int? tenantId, string filter)
       {
           // creates resulting Queue
           var result = new DataTable();

           SqlCommand cmd = null;
           try
           {
               // prepare command
               cmd = new SqlCommand("[dbo].[sp_GetPocInPivot]", (SqlConnection)this.Context.Database.Connection);
               cmd.CommandType = CommandType.StoredProcedure;
               cmd.Parameters.AddWithValue("@TenantId", tenantId.HasValue ? tenantId.Value : (object)DBNull.Value);
               cmd.Parameters.AddWithValue("@Filter", string.IsNullOrEmpty(filter) ? (object)DBNull.Value : filter);

               // Use DataTables to extract the whole table in one hit
               using (SqlDataAdapter da = new SqlDataAdapter(cmd))
               {
                   // fill the datatable
                   da.Fill(result);
               }
           }
           finally
           {
               if (cmd != null)
               {
                   // close command
                   cmd.Dispose();
               }
           }

           return result;
       }

Hi, would you able to provide more details on the actual implementation?

Are you using Custom Repository or EF Integration-Custom Repository methods?

Thanks. /tommy

<cite>ismcagdas: </cite> Hi,

We are not planning to implement this feature in short term. Since this is a common concept of software development, you can find more info and sample implementations on the internet. You can also check Entity Framework's github repository as well.

Thanks.

Hi Support,

Thank you for the confirmation above.

May I know which method I should use:

  1. Custom Repository
  2. Entity Framework Integration - Custom Repository

Hope to get some pointers as I am still learning to developer using Abp framework and the amount of learning is little overwhelming for me right now and I m short of time.

Thanks, /tommy

Answer

Hi Support,

Gratitude for the confirmation and you just checked out one of my task list for today.

Thank you so much! /tommy

<cite>tteoh: </cite>

<cite>ismcagdas: </cite> Hi,

In AspNet Zero, we handled it in this way.

  1. We return the values in UTC to client.
  2. We use <a class="postlink" href="https://momentjs.com/timezone/">https://momentjs.com/timezone/</a> library and set the timezone with user's current timezone setting. You can reach it using "abp.timing.timeZoneInfo.iana.timeZoneId" on the client side.
  3. Then you can use momentjs to format your dates and it will show dates in the specific time zone.

Please write back if you have a different requirement.

Thanks.

Hi Ismail,

Even the default implemented Clock.Provider is set to "Local"? AspNet Zero will first convert the date/time stored in DB in Local to UTC before returning the data to Client side?

Thanks. p/s: Sincere apology if i got your name wrong.

Hi,

With reference to question above, i believe the answer is "No". Correct?

After spending my weekends to step through the program in debug mode and writing to console.log in browser, my understanding is below:

  1. At Application_Start, by setting Clock.Provider = ClockProviders.local OR remove existing setting to UTC, the appliction will run with Unspecified provider. This also means the system is not running with Multiple Timezone: [Yes | No]?
  2. Inherently, the Timezone setting for Application and Users are disabled [Yes | No]?
  3. Abp will save date/time value as-is from browser to database and vice versa [Yes | No]?

Thanks. /Tommy

<cite>ismcagdas: </cite> Hi,

If you need some piece of code in more than app service, it is a good candidate for a domain service. In your case, you can move this code in a domain service and domain services are UOW by default. Maybe this doc can guide you better <a class="postlink" href="http://aspnetboilerplate.com/Pages/Documents/Domain-Services">http://aspnetboilerplate.com/Pages/Docu ... n-Services</a>.

Dear Support,

Please refer to this link: #2567@d519ab56-ce8e-4c12-8639-3586c191cdc6

It was mentioned that Domain Service is NOT UoW by default unlike what being mentioned above.

Appreciate your clarification once again.

Thanks. /tommy

<cite>pkut: </cite> Hi,

Yes, we querying database first, but sometimes it's not enough and insert attempt fail on database constraint. So creating inner unit of work seems to be a solution, but - as far as I remember, documentation says that inner UOW uses the same connection and other DB related stuff as outer UOW. Looks like my understanding is a bit wrong here, please explain the details of how inner UOW works and how can I be sure that we have new DbContext.

Best regards Pavel

Hi Support,

I have the same understanding as Pavel. Could you please kindly clarify his question on inner UoW.

Thanks. /tommy

Dear Support,

My current project is hinging on the numbering module to generate Transaction/Document No.

Really appreciate your advice on where to implement "EF optimistic concurrency" that is aligned to abp framework.

Thanks. /Tommy

Showing 171 to 180 of 202 entries