Base solution for your next web application

Activities of "bbakermmc"

@bobingham Welcome to azure. You get to bang your head for days because nothing is kept current, half the examples are bad/poorly implemented.

This is some code I found when we were playing with key vaults. But there are other implications here, you need to Auth your application so you can pull the keys. So that requires creating an app in AAD, or if you want to use Managed Identies. We are using Managed Identies for most things, but we do have an app id to push files into azure that uses an app id from AAD.

But I know if you want to access a DB you need to get a token for the DB auth provider, if you want to access Storage you need to auth to the Storage auth provider, there is no, hey Im Me give me 1 token.

Note: This is all old test code so I dont know if it still works, or ever did.

//const string SECRETURI = "https://<KEYVAULTURL>/secrets/<SECRETNAME>";
      //KeyVaultClient kvc = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(GetToken));
      //Console.WriteLine(kvc.ToString());

      //var secret = kvc.GetSecretAsync(SECRETURI);
      //Console.WriteLine(secret.Result.Value.ToString());
      ////await GetSecretAsync(vaultURL, vaultKey);

Auth stuff

static string GetUserOAuthToken()
{
const string ResourceId = "https://storage.azure.com/";  // You need to change this to be whatever you are trying to get auth too,
const string AuthInstance = "https://login.microsoftonline.com/{0}/";
const string TenantId = "YourTenantId"; // Tenant or directory ID
 // Construct the authority string from the Azure AD OAuth endpoint and the tenant ID. 
  string authority = string.Format(CultureInfo.InvariantCulture, AuthInstance, TenantId);
  AuthenticationContext authContext = new AuthenticationContext(authority);

  ClientCredential clientCred = new ClientCredential(CLIENTID, CLIENTSECRET);
  AuthenticationResult result = authContext.AcquireTokenAsync(ResourceId, clientCred).Result;

  //// Acquire an access token from Azure AD. 
  //AuthenticationResult result = authContext.AcquireTokenAsync(ResourceId,
  //                                                            "<client-id>",
  //                                                            new Uri(@"<client-redirect-uri>"),
  //                                                            new PlatformParameters(PromptBehavior.Auto)).Result;

  return result.AccessToken;
}

example going to storage account

if (File.Exists(SourceFileName))
{

    if (Debug) Console.WriteLine("Get Token");
    // Get the access token.
    string accessToken = GetUserOAuthToken();

    if (Debug) Console.WriteLine("Get Credentials");
    // Use the access token to create the storage credentials.
    TokenCredential tokenCredential = new TokenCredential(accessToken);
    StorageCredentials storageCredentials = new StorageCredentials(tokenCredential);

    URIName = "https://" + StorageName + ".blob.core.windows.net" + ContainerName;
    if (Debug)
    {
      Console.WriteLine("Get Container");
      Console.WriteLine(URIName);
    }
    CloudBlobContainer BlobContainer = new CloudBlobContainer(new Uri(URIName), storageCredentials);
    CloudBlockBlob blob = BlobContainer.GetBlockBlobReference(DestinationBlob + FileName);

    if (Debug) Console.WriteLine("Copy File");
    blob.UploadFromFile(SourceFileName);

    if (StartImport)
    {
      string ImportFileName = URIName + DestinationBlob + FileName;
      ImportFileName = ImportFileName.Replace(@"\", "/");
      int retVal;
      if (Debug) Console.WriteLine(ImportFileName);
      retVal = LaunchAzureFileImporter(ImportFileName);
    }
  }

@richardghubert what do you think of syncfusion, have any screen shots of some grids/forms you have done? We use devextreme, and have used kendo in the past, but syncfusion was one we never looked at, it didnt seem to to as robust and adaptive as devextreme. But wondering what you think of it.

Dont you also need a second foreign key. Otherwise how would you ever get the 2nd word. I think what the user was saying is the Word Tables has a FK of WordId, but his note table has two references to it WordId and WordId2.

So SQL would be Select * from note left join word on word.wordId = note.wordid left join word on word.wordId = note.wordid2


[ForeignKey("WordId2")]
Public Word Word2 {get;set;)

@commondesk You have alot of the same issues we have, and Ive been bringing up for over a year. Things done really seem to change, they are more focused on the 1x use cases, thats what they seem to want to sell. They are also working on 3 other projects, ABP, and ABP.IO (I would also assume the paid version of ABP.IO as well). Can only hope that the ABP.IO will be better structured for upgrades and support long term. Part of this is the lack of support for the previous versions of metronic. Basically the v4 to v5 was a huge rewrite, hopefully the v5 to v6 isnt as bad. We are still converting to the v5 code, and now v6 is coming out :(. So this means we cant upgrade past 6.9.x, and any new fixes/updates wont be compatable. If they were truly invested in to the customers they would have a v4, v5, v6 branch and then issue an EOL maybe 6m to 1yr to allow people to upgrade away, but not here, 7.0 comes, if you want any of the fixes you need to be ready for v6, even if they have missing features, or broken code (which seems to be the case most times now days). No one says there isnt value, but sometimes we question if we made the right choice rather than just picking a more robust CMS solution where upgrade paths are more defined and thought out. Also not everyone only works on NetZero, we have other platforms we develop on and sometimes it seems like they expect you know every piece of code, even the bundled abp framework, so it becomes a nightmare to be like well did you check the zero help section, then the abp help section. Hopefully the revised documentation will help.

In corporate usage its very normal. You segment clients data to own databases for isolation, internal users need to access multiple clients data to perform tasks. Having multiple accounts is annoying especially since you need to maintain roles and permissions cross clients, and when you on board a new client configure again. Ideally you would have to have a master set of users and limit their client access.

We use SQL just fine. Just generate a new user with a default password you want to use, take the hash and use it. Set user to change password on login. Dont do any of this looping in C# crap, waste of time for a 1x import.

There is a table in the host that you also need to write the newly created user account info to also.

If you make a new user, just look in all the user tables in the tenant and host to trace what needs to be done.

Our DBAs load our tenant dbs with users/permissions/roles for all the internal people that work on that tenants account and we have no issues. (Now we get to add WsFederation so another table to write to if you want to do that too :) )

See: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1336">https://github.com/aspnetzero/aspnet-ze ... ssues/1336</a>

use something like windir and compare the two extracted solutions

Answer

It looks pretty easy to me. <a class="postlink" href="https://docs.microsoft.com/en-us/azure/application-insights/app-insights-asp-net-core">https://docs.microsoft.com/en-us/azure/ ... p-net-core</a>

Then you install the nuget package for logging <a class="postlink" href="https://github.com/Microsoft/ApplicationInsights-dotnet-logging">https://github.com/Microsoft/Applicatio ... et-logging</a>

How did you make your razor pages? Are you inheriting from the base ABPRazorPage? or just Page? I was looking at going down this path also, but I got the PageContext is not valid if I use the abprazorpage and if I use Page I dont get all the localization and stuff and havent had time to go back to work thru making a new class and stuff :) I did add a ticket a while ago about this since I think it would help alot with keep code separated and migrations easier.

<a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1189">https://github.com/aspnetzero/aspnet-ze ... ssues/1189</a>

Showing 1 to 10 of 145 entries