https://discord.umbraco.com
Join Discord
Custom NPOCO database connection... is this a sane approach?
j

Jason

over 1 year ago
I guess this is only tangentially related to Umbraco but the NPOCO docs are a bit sparse and it's not the most popular library in the world. I'm hoping some other lovely Umbracians have experience with this. I've inherited a project I'm upgrading to v13 which uses NPOCO to connect to a different database to Umbraco. From what I can piece together across GitHub comments and Stack Overflow, it looks like the right way to use it is to instantiate and dispose the database object with every request - and rely on .NET's connection pooling to take care of perf... can anyone confirm if this approach is OK?
csharp
private IDatabase GetDatabase() => 
    new Database(ConnectionString, DatabaseType.SqlServer2012, SqlClientFactory.Instance);

public async Task<IEnumerable<vessel>> GetAll()
{
    using var database = GetDatabase();

    return await database.FetchAsync<vessel>("SELECT * FROM " + TableName + " ORDER BY Vessel");
}

//... other repository methods
j
l
  • 2
  • 1
  • 127
How to open media picker from custom property editor (v15.1)
r

rstei

9 months ago
As part of custom property editor, I would like to integrate Umbraco's media picker - to be able to select media items. Is there a context or similar I can use to access this picker?
r
u
  • 2
  • 2
  • 126
error CS0246: The type or namespace name could not be found
w

webjaved

over 2 years ago
Hello, I am getting the following error message;
error CS0246: The type or namespace name 'FeaturedItemsRow' could not be found (are you missing a using directive or an assembly reference?)
Here is the featuredItemsRow.cshtml component file. https://prnt.sc/_gBCXnfJaxwi Here is the block selected as part of my page builder block. https://prnt.sc/p_MqFGvF2X_H I'm working on Umbraco Cloud at the moment but will look at getting the project cloned locally now that I have access to do so.
w
j
  • 2
  • 5
  • 126
uSync Vs Umbraco deploy
t

TigerMan

over 1 year ago
Hi all We're looking into a deployment solution for Umbraco, Umbraco Commerce to Azure. Both of these products seem to come across as being compatible.... Umbraco deploy seems very expensive but uSync seems to do the same but at a cheaper price. Does anyone have experience with these products and any disadvantages before we could make a decision?
t
k
+3
  • 5
  • 7
  • 125
Reinstall Umbraco 13 instance
c

CaptTaifun

about 1 year ago
I have an Umbraco 13 instance and would now like to reinstall it (i.e. set up a new database). I have deleted the SQLite database and the “ConnectionStrings” section from all appsettings.json files. When I now run Umbraco, I only get “Boot Failed”. And in the log file: System.InvalidOperationException: The factory has not been configured with a proper connection string.\n at Umbraco.Cms.Infrastructure.Persistence.UmbracoDatabaseFactory.Initialize()\n at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock What else do I have to do to recreate the database/reinstall the instance?
c
h
+4
  • 6
  • 8
  • 124
Delivery Api with Jwt Authentication
k

Khattab

over 1 year ago
I am building a headless Next website that will consume the content delivery api to render the content curated in Umbraco, the Next web app is secured with OpenId and users login to the web app and acquires an access token that will be used to communicate with Umbraco, we have configured Jwt for Umbraco and we can resolve the users when requesting Umbraco resources, the issue we are trying to solve is securing the content delivery api, according to the documentation the only way to authorize users users to consume the content delivery Api is by acquiring another token from Umbraco which acts as an identity provider, given the nature of Jwt middleware when I try to execute an authorize request with the token passed from the Next web app I receive the the client_id is empty, this is true because Jwt configurations doesn’t have a client id, also there will be now auth flow to authenticate against as the user authentication flow is already executed at the frontend side, when I checked the base delivery controller I found that it’s decorated with an Authorize filter that requires a policy that mandates that only token issued by the OpenIddict schema. So my question is there a way to go around this or extend the Api to allow requests issued by my custom Jwt scheme as well?
k
a
  • 2
  • 6
  • 124
Setting CORS for Content Delivery API
d

Dean Leigh

over 1 year ago
I have got UmBootstrap working as a Content Delivery API in an Azure Web App and the same page using the JSON in a static HTMX site. However, to do so I have had to allow an origin in Azure. How can I protect that origin so that only my static site can access the API?
d
m
  • 2
  • 4
  • 124
Umbraco 14 how to display custom section's content.
a

Abradolf Lincler

over 1 year ago
Hey so I've created custom section following the documentation, but i can't find anything about putting content in it. This is what i've done. I've also tried creating sectionView and it worked but it's not put in the content of the section I've created. https://cdn.discordapp.com/attachments/1252932290049216564/1252932290225639445/image.png?ex=667403a0&is=6672b220&hm=cbb6958896e391a683d7c16bb22549280c1d30652820739952d5540296487887& https://cdn.discordapp.com/attachments/1252932290049216564/1252932290443612181/image.png?ex=667403a0&is=6672b220&hm=bd2d5a53d2325f3d6b01ff07117ffb94b2370b9f5418300f4fd61a589340765b& https://cdn.discordapp.com/attachments/1252932290049216564/1252932290783219793/image.png?ex=667403a0&is=6672b220&hm=529d7a43c9c76abb754f5ae614af13cb83cfe5db4881cea01e59b98541a42af4&
a
b
  • 2
  • 3
  • 123
Scraping Meta-Data using Blazor WASM in the back office
d

Dean Leigh

over 1 year ago
Cross-Origin Resource Sharing issues
d
  • 1
  • 4
  • 119
Getting UmbracoHelper in class
t

TigerMan

over 1 year ago
Hi all I'm using the below code in Umbraco 13 custom class public IPublishedContent GetProductById(int id) { var accessor = StaticServiceProvider.Instance.GetRequiredService(); if (accessor.TryGetUmbracoHelper(out var umbracoHelper)) { return umbracoHelper.Content(id); } return null; } This returns the error InvalidOperationException wasn't able to get an UmbracoContext. When searching on this error, most lead me to Umbraco 9 bugs so wondering if I'm missing something?
t
d
  • 2
  • 8
  • 119
Previous202122Next

Umbraco

A hub and casual space for you to interact with fellow community members and learn more about Umbraco!

Powered by